There are 2 stores in Chefland and both sell the same product. The first store sells the product for 100 rupees whereas the second store sells it for 200 rupees.

It is the holiday season and both stores have announced a special discount. The first store is providing a discount of A percent on its product and the second store is providing a discount of B percent on its product.

Chef is wondering which store is selling the product at a cheaper price after the discount has been applied. Can you help him identify the better deal?

------ Input Format ------ 

- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case consists of a single line of input containing two space-separated integers A and B denoting the discount provided by the first and second store respectively. 

------ Output Format ------ 

For each test case, output FIRST if the first store is cheaper, SECOND if the second store is cheaper, and BOTH if both the stores are selling the product for the same price after discount.

The checker is case-insensitive so answers like FiRsT, first, and FIRST would be considered the same.

------ Constraints ------ 

$1 ≤ T ≤ 1000$
$1 ≤ A, B ≤ 100$

----- Sample Input 1 ------ 
4
5 20
10 60
7 7
10 55

----- Sample Output 1 ------ 
FIRST
SECOND
FIRST
BOTH

----- explanation 1 ------ 
Test case $1$: The first store has a discount of $5\%$. Thus, the final price of product at first store would be $95$.  
The second store has a discount of $20\%$. Thus, the final price of the product at the second store would be $160$. The product at the first store would be cheaper.

Test case $2$: The first store has a discount of $10\%$. Thus, the final price of product at first store would be $90$.  
The second store has a discount of $60\%$. Thus, the final price of the product at the second store would be $80$. The product at the second store would be cheaper.

Test case $3$: The first store has a discount of $7\%$. Thus, the final price of product at first store would be $93$.  
The second store has a discount of $7\%$. Thus, the final price of the product at the second store would be $186$. The product at the first store would be cheaper.

Test case $4$: The first store has a discount of $10\%$. Thus, the final price of product at first store would be $90$.  
The second store has a discount of $55\%$. Thus, the final price of the product at the second store would be $90$. The product at both stores would have same price.

Source: codechef | Difficulty: EASY
Tags: Mathematics


Solutions:
t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	a = 100 - x * 100 // 100
	b = 200 - y * 200 // 100
	if a == b:
		print('BOTH')
	elif a < b:
		print('FIRST')
	else:
		print('SECOND')


a = int(input())
for i in range(0, a):
	(x, y) = map(int, input().split())
	new_x = 100 - 100 * x / 100
	new_y = 200 - 200 * y / 100
	if new_x == new_y == min(new_x, new_y):
		print('BOTH')
	elif new_x == min(new_x, new_y):
		print('FIRST')
	else:
		print('SECOND')


import math
n = int(input())
for i in range(n):
	(x, y) = [int(x) for x in input().split()]
	p = math.ceil(100 - 100 * (x / 100))
	q = math.ceil(200 - 200 * (y / 100))
	if p > q:
		print('SECOND')
	elif p < q:
		print('FIRST')
	else:
		print('BOTH')


t = int(input())
while t:
	(a, b) = map(int, input().split())
	a = 100 - a
	b = 200 - 2 * b
	print('FIRST' if a < b else 'BOTH' if a == b else 'SECOND')
	t -= 1


x = int(input())
for i in range(x):
	(a, b) = map(int, input().split())
	dis1 = int(a / 100 * 100)
	dis2 = int(b / 100 * 200)
	y = 100 - dis1
	z = 200 - dis2
	if y < z:
		print('FIRST')
	elif z < y:
		print('SECOND')
	else:
		print('BOTH')


N = int(input())
for i in range(N):
	(A, B) = map(int, input().split())
	first = round(100 - 100 * (A / 100))
	second = round(200 - 200 * (B / 100))
	if first > second:
		print('SECOND')
	elif first < second:
		print('FIRST')
	elif first == second:
		print('BOTH')


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	d1 = 100 - x
	d2 = 200 - 2 * y
	if d1 < d2:
		print('FIRST')
	elif d1 > d2:
		print('SECOND')
	else:
		print('BOTH')


for k in range(int(input())):
	(a, b) = map(int, input('').split())
	c = a * 100 / 100
	d = b * 200 / 100
	e = 100 - c
	f = 200 - d
	if e < f:
		print('FIRST')
	elif e > f:
		print('SECOND')
	else:
		print('BOTH')


a = int(input())
l = []
for i in range(0, a):
	(a, b) = map(int, input().split())
	ap = 100 - a
	bp = 2 * (100 - b)
	if ap < bp:
		l.append('FIRST')
	elif ap > bp:
		l.append('SECOND')
	else:
		l.append('BOTH')
for i in l:
	print(i)


T = int(input())
for i in range(T):
	(A, B) = map(int, input().split())
	A = 100 - A * 100 / 100
	B = 200 - B * 200 / 100
	if A < B:
		print('FIRST')
	elif A > B:
		print('SECOND')
	else:
		print('BOTH')


for T in range(int(input())):
	(A, B) = map(int, input().split())
	a = 100 - 100 * A / 100
	b = 200 - 200 * B / 100
	if a < b:
		print('FIRST')
	elif a > b:
		print('SECOND')
	elif a == b:
		print('BOTH')


for i in range(int(input())):
	(a, b) = map(int, input().split())
	a = 100 - a
	b = 2 * (100 - b)
	if a < b:
		print('FIRST')
	elif a > b:
		print('SECOND')
	else:
		print('BOTH')


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	storeA = 100 - int(100 * (a / 100))
	storeB = 200 - int(200 * (b / 100))
	if storeA < storeB:
		print('FIRST')
	elif storeA > storeB:
		print('SECOND')
	else:
		print('BOTH')


T = int(input())
for i in range(0, T):
	(A, B) = map(int, input().split())
	x = 100 - A
	y = 200 - B * 2
	if x > y:
		print('SECOND')
	elif x == y:
		print('BOTH')
	else:
		print('FIRST')


t = int(input())
for _ in range(t):
	(d1, d2) = list(map(int, input().split()))
	p1 = 100
	p2 = 200
	f1 = p1 - int(d1 / 100 * p1)
	f2 = p2 - int(d2 / 100 * p2)
	if f1 > f2:
		print('SECOND')
	elif f1 == f2:
		print('BOTH')
	else:
		print('FIRST')


t = int(input())
for i in range(0, t):
	discount = list(map(int, input().split()))
	A = discount[0] / 100 * 100
	B = discount[1] / 100 * 200
	if round(100 - A) < round(200 - B):
		print('FIRST')
	elif round(200 - B) < round(100 - A):
		print('SECOND')
	elif round(100 - A) == round(200 - B):
		print('BOTH')


a = int(input())
for i in range(a):
	(x, y) = map(int, input().split())
	first = 100 - 100 * x // 100
	second = 200 - 200 * y // 100
	if first < second:
		print('FIRST')
	elif second < first:
		print('SECOND')
	else:
		print('BOTH')


for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	c = 100 - 100 * a / 100
	d = 200 - 200 * b / 100
	if c < d:
		print('FIRST')
	elif c > d:
		print('SECOND')
	else:
		print('BOTH')


for i in range(int(input())):
	(x, y) = list(map(int, input().split()))
	if 100 - x > 200 - 2 * y:
		print('SECOND')
	elif 100 - x < 200 - 2 * y:
		print('FIRST')
	else:
		print('BOTH')


for i in range(int(input())):
	x = list(map(int, input().split()))
	pr_1 = 100 / 100 * x[0]
	pr_1_t = abs(100 - pr_1)
	pr_2 = 200 / 100 * x[1]
	pr_2_t = abs(200 - pr_2)
	a = int(pr_1_t)
	b = int(pr_2_t)
	if a < b:
		print('FIRST')
	elif a == b:
		print('BOTH')
	else:
		print('SECOND')


for i in range(0, int(input())):
	s = input().split()
	if 100 - int(s[0]) < (100 - int(s[1])) * 2:
		print('FIRST')
	elif 100 - int(s[0]) > (100 - int(s[1])) * 2:
		print('SECOND')
	else:
		print('BOTH')


t = int(input())
for i in range(t):
	(A, B) = list(map(int, input().split()))
	a = 100 - A
	b = 200 - 2 * B
	if a < b:
		print('FIRST')
	elif a > b:
		print('SECOND')
	elif a == b:
		print('BOTH')


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	a = 100 - n
	b = 200 - 2 * m
	if a > b:
		print('SECOND')
	elif a == b:
		print('BOTH')
	else:
		print('FIRST')


t = int(input())
for _ in range(t):
	(f, s) = map(int, input().split())
	first = 100 * (100 - f)
	second = 200 * (100 - s)
	if first > second:
		print('SECOND')
	elif first == second:
		print('BOTH')
	else:
		print('FIRST')


import math
try:
	T = int(input())
	if T >= 1 and T <= 1000:
		for t in range(0, T):
			(A, B) = map(int, input().split(' '))
			if A >= 1 and A <= 100:
				if B >= 1 and B <= 100:
					first = 100 - 100 * (A / 100)
					second = 200 - 200 * (B / 100)
					first = math.ceil(first)
					second = math.ceil(second)
					if first < second:
						print('FIRST')
					elif first > second:
						print('SECOND')
					else:
						print('BOTH')
except ValueError:
	print('You have committed some values errors in inputs')


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	c = 100 - a
	d = 200 - b * 2
	if c < d:
		print('FIRST')
	elif c > d:
		print('SECOND')
	elif c == d:
		print('BOTH')


for i in range(int(input())):
	(a, b) = map(int, input().split())
	p = 100 - 100 * a / 100
	q = 200 - 200 * b / 100
	if p < q:
		print('FIRST')
	elif p == q:
		print('BOTH')
	else:
		print('SECOND')


for i in range(int(input())):
	(a, h) = map(int, input().split())
	g = 100 - 100 * a // 100
	k = 200 - 200 * h // 100
	if g > k:
		print('SECOND')
	elif g == k:
		print('BOTH')
	else:
		print('FIRST')


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = 100
	d = 200
	e = c
	f = d
	a /= 100
	b /= 100
	e *= a
	f *= b
	c -= e
	d -= f
	c = round(c)
	d = round(d)
	if c < d:
		print('FIRST')
	elif d < c:
		print('SECOND')
	elif c == d:
		print('BOTH')


import math
for t in range(int(input())):
	(a, b) = map(int, input().split())
	f_a = 100 * (a / 100)
	f_b = 200 * (b / 100)
	if math.ceil(100 - f_a) < math.ceil(200 - f_b):
		print('FIRST')
	elif math.ceil(100 - f_a) == math.ceil(200 - f_b):
		print('BOTH')
	else:
		print('SECOND')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	z = 100 - a
	y = 200 - b * 2
	if z < y:
		print('FIRST')
	elif y < z:
		print('SECOND')
	else:
		print('BOTH')


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	if 100 - x > 200 - 2 * y:
		print('SECOND')
	elif 100 - x < 200 - 2 * y:
		print('FIRST')
	else:
		print('BOTH')


T = int(input())
while T:
	(a, b) = map(int, input().split())
	d1 = 100 * a // 100
	d2 = 200 * b // 100
	if 100 - d1 < 200 - d2:
		print('FIRST')
	elif 100 - d1 > 200 - d2:
		print('SECOND')
	else:
		print('BOTH')
	T -= 1