#P1168. Er Ba Game

Er Ba Game

Background

2021nowcoder多校day2 数据手造,如果想品尝原汁原味的数据,请在nowcoder购买

Description

Er Ba Game is a popular card game in China's Province Zhejiang.

In this problem, the game involves two players and 36 cards 2,3,,10 - 2,3,⋯ ,10, each with four.

In the game each player takes 2 cards(a1,b1)(a_1,b_1) , (a2,b2)(a_2,b_2).Player i{i} gets (ai,bi)(a_i,b_i) . Suppose a1b1,a2b2a_1\leq b_1,a_2\leq b_2, and we determine the winner as follow:

  • (2,8){(2,8)} is the biggest pair.
  • If neither is (2,8){(2,8)}, a pair with a=b{a=b} is greater than a pair without.
  • If a1=b1a_1=b_1 and a2=b2a_2=b_2, then compare a1,a2a_1,a_2.The bigger one wins.
  • If a1b1,a2b2a_1\ne b_1,a_2\ne b_2, compare $(a_1+b_1)\ \text{mod}\ 10,(a_2+b_2)\ \text{mod}\ 10$.The bigger one wins.
  • If a1b1,a2b2a_1\ne b_1,a_2\ne b_2 and $(a_1+b_1)\ \text{mod}\ 10=(a_2+b_2)\ \text{mod}\ 10$,compareb1,b2b_1,b_2.The bigger one wins.

If a1b1,a2b2a_1\leq b_1,a_2\leq b_2 does not hold, we can exchange a1a_1 and b1b_1 or exchange a2a_2 and b2b_2 until the formula holds.

You're told a1,b1,a2,b2a_1,b_1,a_2,b_2, and you should tell who's gonna win the game.

Format

Input

The first line contains an integer TTT{T} — number of game cases. Then TTT{T} lines, each contains four integers a1,b1,a2,b2a_1,b_1, a_2,b_2, denoting the cards of each player.

Output

Output T{T} lines.

If player 1 wins, output "first" (without quote).

If player 2 wins, output "second" (without quote).

Otherwise, output "tie" (without quote).

Samples

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.

Limitation

1s, 1024KiB for each test case

It's guaranteed that T100,2a1,b1,a2,b210T\leq 100,2\leq a_1,b_1,a_2,b_2\leq 10.

It's not guaranteed that a1b1,a2b2a_1\leq b_1,a_2\leq b_2.