There is a right triangle with legs of length *a* and *b*. Your task is to determine whether it is possible to locate the triangle on the plane in such a way that none of its sides is parallel to the coordinate axes. All the vertices must have integer coordinates. If there exists such a location, you have to output the appropriate coordinates of vertices.
The first line contains two integers *a*, *b* (1 ≤ *a*, *b* ≤ 1000), separated by a single space.
import sys
import math
eps = 0.0000001

def GetAnotherLeg(c,a):
	sqr = c*c - a*a
	if (sqr > 0):
		b = math.sqrt(sqr)
		if math.fabs(math.trunc(b)-b)<=eps:
			return (True, b)
	return (False,0)

def test(x1,y1,x2,y2):
	y1 = int(y1)
	y2 = int(y2)
	if not x1*x2+y1*y2==0:
		return False
	if x1==0 or y1==0 or x2==0 or y2==0:
		return False
	else:
		print("YES")
		print(0," ",0)
		print(x1," ",y1)
		print(x2," ",y2)
		return True


line = [int(i) for i in input().split()]
a = line[0]
b = line[1]

for x1 in range(1,a):
	y1isint,y1 = GetAnotherLeg(a, x1)
	if y1isint:
		for x2 in range(1,a+b):
			y2isint,y2 = GetAnotherLeg(b, x2)
			if y2isint:
				if test(x1, y1, x2, y2):
					sys.exit()
				y2 = -1*y2
				if test(x1, y1, x2, y2):
					sys.exit()
print("NO")



