Paul was the most famous character in Tekken-3. Of course he went to college and stuff. In one of the exams he wasn't able to answer a question which asked to check if a tuple of 3 non negative integers constituted a Primitive Pythagorian Triplet or not.  Paul was not able to answer it correctly and henceforth, he could not concentrate on any fight for a very long time and lost most of them. So, he decided to learn everything about Primitive Pythagorian Triplets.

Now, Paul seeks your help to determine whether a given triplet is a Primitive Pythagorian Triplet or not.

INPUT :  

The first line of the input contains the number of test cases T.
Every test case has a single line containing 3 space separated integers a,b and c.

OUTPUT :   

The output to each test case is a "YES" or a "NO".

CONSTRAINTS :   

1 ≤ T ≤ 100000

0 ≤ a,b,c ≤ 10000000

NOTE:
A primitive Pythagorean triple is one in which a, b and c are coprime.

SAMPLE INPUT
4
3 4 5
10 8 6
9 2 5
12 5 13

SAMPLE OUTPUT
YES
NO
NO
YES

Difficulty: EASY

Solutions:
def gcd(x, y):
	while y:
		x, y = y, x%y
	return x

for i in range(eval(input())):
	L = (a, b, c) = list(map(int, input().split()))
	print('YES' if gcd(a,b)==gcd(a,c)==gcd(b,c)==1 and (sum([j**2 for j in L])/2)**0.5 in L else 'NO')


import math
def gcd(a,b):
	if b==0:
		return a
	else:
		return gcd(b,a%b)
t = eval(input())
for _ in range(t):
	ar = list(map(int,input().split()))
	ar.sort()
	a,b,c = ar[0],ar[1],ar[2]
	if (math.sqrt(pow(a,2) + pow(b,2)) == c) and gcd(a,gcd(b,c)) == 1:
		print("YES")
	else:
		print("NO")


def gc(a,b):
	if b==0:
		return a
	else:
		return gc(b,a%b)

import sys
t=int(input())
while t>0:
	t-=1
	a,b,c=list(map(int,input().split()))
	z=gc(a,b)
	s=gc(z,c)
	

	if (a**2 + b**2 == c**2 or a**2 + c**2 == b**2 or b**2 + c**2==a**2) and s==1 :
		print('YES')
	else:
		print('NO')


def gcd(a,b):
	if b==0:
		return a
	else:
		return gcd(b,a % b)
for p in range(eval(input())):
	a,b,c=sorted(map(int,input().split()))
	#print a,b,c
	if gcd(gcd(c,b),a)==1 and c**2==a**2+b**2:
		print("YES")
	else:
		print("NO")
	


def gcd(x, y):
	while y:
		x, y = y, x%y
	return x

for i in range(eval(input())):
	L = (a, b, c) = list(map(int, input().split()))
	print('YES' if gcd(a,b)==gcd(a,c)==gcd(b,c)==1 and pow(sum([j**2 for j in L])/2, 0.5) in L else 'NO')


t=eval(input())
for j in range(t):
	a,b,c=list(map(int,input().split()))
	x=a
	y=b
	flag=0
	while(y):
		x,y=y,x%y
	flag+=x
	y,z=b,c
	while(z):
		y,z=z,y%z
	flag+=y
	x,z=a,c
	while(x):
		z,x=x,z%x
	flag+=z
	a,b,c=a*a,b*b,c*c
	if(flag==3 and (a+b==c or b+c==a or a+c==b)):
		print("YES")
	else:
		print("NO")
		


def gcd(a,b):
	if(b==0):
		return a
	else:
		return gcd(b,a%b)
def iscoprime(a,b,c):
	if(gcd(a,b)==gcd(b,c) and gcd(b,c)==gcd(c,a) and gcd(a,b)==1):
		return True
	else:
		return False
def main():
	for _ in range(eval(input())):
		to=list(map(int,input().split()))
		to.sort()
		if(to[0]**2+to[1]**2==to[2]**2 and iscoprime(to[0],to[1],to[2])):
			print("YES")
		else:
			print("NO")
			
if __name__=="__main__":
	main()


def gcd(a,b):
	t = b
	b = a % b
	if b == 0:
		return t
	else:
		return gcd(t,b)

def isCoprime(a,b,c):
	return gcd(a,b)==1 and gcd(b,c)==1 and gcd(a,c)==1

t=eval(input())
while t>0:
	t-=1
	triples=list(map(int, input().split()))[:3]
	triples.sort()
	a=triples[0]
	b=triples[1]
	c=triples[2]
	if isCoprime(a,b,c) and c*c==(b*b+a*a):
		print("YES")
	else:
		print("NO")


def gcd(i,j):
	if(j==0):
		return i
	else:
		return gcd(j,i%j)



def isCoprime(a,b,c):
	if gcd(a,b)==1 and gcd(b,c)==1 and gcd(a,c)==1:
		return True
	return False


t=eval(input())
while t>0:
	arr=[int(x) for x in input().split()]
	h=max(arr)
	arr.remove(h)
	if((h*h==(arr[0]*arr[0]+arr[1]*arr[1]))and isCoprime(h,arr[0],arr[1])):
		print('YES')
	else:
		print('NO')
	t=t-1


t=eval(input())
for j in range(t):
	a,b,c=list(map(int,input().split()))
	x=a
	y=b
	flag=0
	while(y):
		x,y=y,x%y
	flag+=x
	y,z=b,c
	while(z):
		y,z=z,y%z
	flag+=y
	x,z=a,c
	while(x):
		z,x=x,z%x
	flag+=z
	a,b,c=a*a,b*b,c*c
	if(flag==3 and (a+b==c or b+c==a or a+c==b)):
		print("YES")
	else:
		print("NO")
		


def gcd(u, v):
	return gcd(v, u % v) if v else abs(u)
test = int(input())
for i in range (test):
	a,b,c = input().split(" ")
	a = int(a)
	b = int(b)
	c = int(c)
	g1 = gcd(a,b)
	g2 = gcd(b,c)
	g3 = gcd(a,c)
	#print(g1)
	#print(g2)
	#print(g3)
	if(g1!=1 or g2!=1 or g3!=1):
		print("NO")
	elif (c*c == a*a+b*b):
		print("YES")
	elif (a*a == c*c+b*b):
		print("YES")
	elif (b*b == a*a+c*c):
		print("YES")
	else:
		print("NO")


def gcd(a,b):
	return a if (b==0) else gcd(b,a%b)
for _ in range(eval(input())):
	Numbers = sorted(map(int,input().split()))
	a,b,c=Numbers[0],Numbers[1],Numbers[2]
	print("YES" if (gcd(a,b)==1 and gcd(b,c)==1 and gcd(c,a)==1 and (a*a)+(b*b)==(c*c)) else "NO")


def gcd(x, y):
	while y != 0:
		(x, y) = (y, x % y)
	return x
def main():
	t = int(input())
	while t>0:
		t = t-1;
		a,b,c = list(map(int,input().split()))
		if b>=a and b>=c:
			z=b;
			b=a;
			a=b;
		elif c>=a and c>=b:
			z=c;
			c=a;
			a=z;
		p=b*b + c*c;
		q=a*a;
		if p==q:
			if gcd(a,gcd(b,c))==1:
				print("YES")
			else:
				print("NO")
		else:
			print("NO")
main()    


from functools import reduce
def hcf(a, b):
	if b == 0:
		return a
	else:
		return hcf(b, a % b)


def gcd(a, b, c):
	return reduce(hcf, (a,b,c))
		
		
t = eval(input())

for y in range(t):
	a, b, c = sorted(map(int, input().split()))
	
	if (((a*a) + (b*b)) == (c*c)) and gcd(a, b, c) == 1:
		print("YES")
	else:
		print("NO")


def gcd(a, b):
	while b != 0:
		t = b
		b = a%b
		a = t
	return a

t=int(input().strip())
for x in range(t):
	a,b,c=list(map(int,input().split()))
	#print a,b,c
	flag=False
	if a>b and a>c:
		#print 'a is greatest'
		#print gcd(a,b),gcd(b,c)
		if (b**2 + c**2 == a**2) and gcd(a,b) == 1 and gcd(b,c) == 1:
			flag=True
	elif b>a and b>c:
		#print 'b is greater'
		if (a**2 + c**2 == b**2) and gcd(a,b) == 1 and gcd(b,c) == 1:
			flag=True
	else:
		#print 'c is greater'
		if b**2 + a**2 == c**2 and gcd(a,b) == 1 and gcd(b,c) == 1:
			flag=True
		
	if 	flag == True:
		print('YES')
	else:
		print('NO')


from fractions import *
for i in range(eval(input())):
	a=list(map(int,input().split()))
	a.sort()
	b=a[1]
	c=a[2]
	a=a[0]
	if a**2 + b**2 == c**2:
		if (gcd(a,b) == 1) and (gcd(b,c) == 1) and (gcd(a,c) == 1):
			print('YES')
		else:
			print('NO')
	else:
			print('NO')