Problem
Chef has to travel to another place. For this, he can avail any one of two cab services.
- The first cab service charges rupees.
- The second cab service charges rupees.
Chef wants to spend the minimum amount of money. Which cab service should Chef take?
Input Format
- The first line will contain - the number of test cases. Then the test cases follow.
- The first and only line of each test case contains two integers and - 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 FIRST
, SECOND
and ANY
in uppercase or lowercase (for example, any
, aNy
, Any
will be considered identical).
Constraints
Sample 1:
3 30 65 42 42 90 50
FIRST ANY SECOND
Explanation:
Test case : The first cab service is cheaper than the second cab service.
Test case : Both the cab services have the same price.
Test case : The second cab service is cheaper than the first cab service.
Program :
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
for (int i=0;i<n;i++)
{
int a=sc.nextInt();
int b=sc.nextInt();
if (a<b)
{
System.out.println("FIRST");
}
else if (a==b)
{
System.out.println("ANY");
}
else
{
System.out.println("SECOND");
}
}
}
}
0 Comments