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 math
import timeit
pyth = {}
for a in range(1,1000):
        for b in range(a+1,1000):
                t = math.floor(math.sqrt(a*a + b*b))
                if(t>1000):
                        break
                if(t*t==a*a+b*b):
                        pyth[t] = (a,b)
a,b = tuple(int(i) for i in input().split())

if (not a in pyth) or (not b in pyth):
        print("NO")
else:
        p2x, p2y = pyth[a]
        p3x, p3y = pyth[b]
        #print(pyth[a],pyth[b])
        print("YES")
        print(0,0)
        print(p2x,p2y)
        p2x -= p3y
        p2y += p3x
        print(p2x,p2y)
