5299: Er Ba Game

内存限制:256 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:2 解决:1

题目描述

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 each with four.
In the game each player takes 2 cards (a1,b1) , (a2,b2) .Player i gets (ai,bi) . Suppose a1≤b1,a2≤b2, and we determine the winner as follow: 
  1. (2,8) is the biggest pair. 
  2. If neither is (2,8), a pair with a=b is greater than a pair without. 
  3. If a1=b1 and a2=b2, then compare a1,a2.The bigger one wins. 
  4. If a1≠b1,a2≠b2, compare (a1+b1) mod 10,(a2+b2) mod 10.The bigger one wins. 
  5. If  a1≠b1,a2≠b2 and (a1+b1) mod 10=(a2+b2) mod 10,compare b1,b2.The bigger one wins.

If a1≤b1,a2≤b2 does not hold, we can exchange a1 and b1 or exchange a2 and b2 until the formula holds. 

You're told  a1,b1,a2,b2, and you should tell who's gonna win the game.

输入

The first line contains an integer T — number of game cases.
Then T lines, each contains four integers a1,b1,a2,b2, denoting the cards of each player.

输出

Output TT lines.

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

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

Otherwise, output "tie" (without quote).

样例输入 复制

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

提示

It's guaranteed that T≤100,2≤a1,b1,a2,b2≤10.

It's not guaranteed that a1≤b1,a2≤b2.