Strings
Practice
2.4 (30 votes)
Approved
Combinatorics
Easy
Math
Open
String manipulation
Problem
84% Success 18850 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Anton and Artur are old friends. Today they practice in writing strings. Anton must write each string with the lengths exactly N , based on the alphabet of size M . And Arthur, on the contrary, should write each string with the lengths exactly M , based on the alphabet of size N . Guys spend 1 second to write a single string. They start writing at the same time.
And now boys are interested in one question. Is it true, that they will finish together? (It is assumed that the guys don't pause during the writing of strings).

Input

First line of the input contains the number of test cases T . It is followed by T tets cases. Each test case has 1 line. Line contains two integer numbers N and M separated by a single space.

Output

For each test case output "YES" if Anton and Artur will finish at the same time. Else print "NO"

Constraits

1 <= T <= 50
1 <= N, M <= 10^10000

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
45 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
Points:20
22 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyException handlingImplementationjava
Points:20
121 votes
Tags:
ApprovedEasyImplementationMathOpenReady