strings-1

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 

SAMPLE INPUT
3
1 1
1 3
100 500

SAMPLE OUTPUT
YES
NO
NO

Explanation

In the second case Anton should write three strings. But Artur should write only one string, and he will finish earlier.

Difficulty: EASY
Tags: Combinatorics

Mathematics

Starter code:

Solutions:
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
for i in range(eval(input())):
	a,b=list(map(int,input().split()))
	if(a==b):
		print("YES")
	elif(a==2 and b==4 or a==4 and b==2):
		print("YES")
	else:
		print("NO")
	



from math import log
t = int(input())
for i in range(t):
	m, n = [int(x) for x in input().split()]
	if m == 1 or n == 1: 
		if m == n: print("YES")
		else: print("NO")
	elif log(m) - log(n) == log(log(m)) - log(log(n)): print("YES")
	else: print("NO")


for i in range(int(input())):
	lst = list(map(int,input().split()))
	
	if pow(lst[0], lst[1],pow(10,10)+7) == pow(lst[1], lst[0],pow(10,10)+7): print("YES")
	else: print("NO")


T=int(input())
for t in range (0,T):
	p=0
	a=[]
	a = [int(z) for z in input().split()]
	m=a[0]
	n=a[1]
	if m==n:
		print("YES")
	elif (m==4 and n==2)or (m==2 and n==4):
		print("YES")
	else:
		print("NO")
		
	


for i in range(eval(input())):
	l=[int(x) for x in input().split()]
	if(l[0]==l[1]):
		print("YES")
	elif(l[0]==2 and l[1]==4):
		print("YES")
	elif(l[0]==4 and l[1]==2):
		print("YES")
	else:
		print("NO")
		


for i in range(int(input())):
	lst = list(map(int,input().split()))
	
	if pow(lst[0], lst[1],pow(10,4)+7) == pow(lst[1], lst[0],pow(10,4)+7): print("YES")
	else: print("NO")


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
T = int(input())
N = []
M = []
for i in range(T):
	x,y = list(map(int,input().split()))
	N.append(x)
	M.append(y)

for i in range(T):
	if N[i] == M[i]:
		print("YES")
	elif (N[i] == 2 and M[i] == 4) or (N[i] == 4 and M[i] == 2):
		print("YES")
	else:
		print("NO")


from math import log
t = int(input())
for i in range(t):
	m, n = [int(x) for x in input().split()]
	if m == 1 or n == 1: 
		if m == n: print("YES")
		else: print("NO")
	elif log(m) - log(n) == log(log(m)) - log(log(n)): print("YES")
	else: print("NO")


for i in range(int(input())):
	lst = list(map(int,input().split()))
	
	if pow(lst[0], lst[1],pow(10,4)+7) == pow(lst[1], lst[0],pow(10,4)+7): print("YES")
	else: print("NO")