时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
Er Ba Game is a popular card game in China's Province Zhejiang.
In this problem, the game involves two players and 36 cards -

, each with four.
In the game each player takes 2 cards
)
,
)
.Player

gets
)
. Suppose

, and we determine the winner as follow:
-
is the biggest pair. - If neither is
, a pair with
is greater than a pair without. - If
and
, then compare
.The bigger one wins. - If
, compare
.The bigger one wins. - If
and
,compare
.The bigger one wins.
If

does not hold, we can exchange

and

or exchange

and

until the formula holds.
You're told

, and you should tell who's gonna win the game.
输入描述:
The first line contains an integer
— number of game cases.
Then
lines, each contains four integers
, denoting the cards of each player.
输出描述:
Output

lines.
If player 1 wins, output "first" (without quote).
If player 2 wins, output "second" (without quote).
Otherwise, output "tie" (without quote).
示例1
输入
复制
5
2 8 4 6
6 6 6 7
4 5 5 5
6 3 9 10
7 2 2 7
输出
复制
first
first
second
second
tie
说明
The answers to the first four sets of data are obtained through the first, second, second, and fifth rules respectively.
备注:
It's guaranteed that

.
It's not guaranteed that
.