CodechefSep 16, 2025

The Cheaper Cab

Hazrat Ali

Codechef

Chef wants to spend the minimum amount of money. Which cab service should Chef take?

Input Format

  • The first line will contain T - the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains two integers X and Y - the prices of first and second cab services respectively.

Output Format

For each test case, output FIRST if the first cab service is cheaper, output SECOND if the second cab service is cheaper, output ANY if both cab services have the same price.

You may print each character of FIRSTSECOND and ANY in uppercase or lowercase (for example, anyaNyAny will be considered identical).

Constraints

  • 1≤T≤100
  • 1≤X,Y≤100

Sample 1:

Input
3
30 65
42 42
90 50
Output
 
FIRST
ANY
SECOND

Solution

t = int(input())
for _ in range(t):
    x, y = map(int, input().split())
    if x > y:
        print("SECOND")
    elif x == y:
        print("ANY")
    else:
        print("FIRST")


Comments