English version is in beta. All contents of the site should be already translated (mostly using machine translation), and everything should work properly. However, if you find any problems, please contact me.
The problem statement has been automatically translated from Russian. If the statement is not clear, or you have any comments about it, please contact me. Anyway, I hope that someday I will fix the translation manually.

The Drunkard's Game

In a drunkard game, a deck of cards is distributed equally to two players. Next, they open one top card each, and the one whose card is older takes both of the opened cards, which are placed under the bottom of his deck. The one who remains without cards loses.

For simplicity, we will assume that all cards are different in face value, and also that the lowest card wins the highest card ("six takes an ace").

The player who takes the cards for himself first puts the card of the first player under the bottom of his deck, then the card of the second player (that is, the card of the second player is at the bottom of the deck).

Write a program that simulates a drunkard game and determines who wins. The game involves 10 cards with values from 0 to 9, the larger card defeats the smaller one, the card with a value of 0 defeats the card 9.

Input data

The program receives two lines for input: the first line contains 5 numbers separated by spaces — the numbers of the cards of the first player, the second – similarly 5 cards of the second player. The cards are listed from top to bottom, that is, each row starts with the card that will be opened first.

Output data

The program must determine who wins in this hand, and output the word first or second, and then output the number of moves made before winning. If the game does not end within 10 6 moves, the program should output the word botva.

Examples
Input data
1 3 5 7 9
2 4 6 8 0
Output data
second 5

This problem on informatics