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 
a,b = map(int,input().split())
X = []
Y = []
def isPerfectSquare(x):
 
    #if x >= 0,
    if(x >= 0):
        sr = math.sqrt(x)
        # sqrt function returns floating value so we have to convert it into integer
        #return boolean T/F
        return ((sr*sr) == float(x))
    return False
for i in range(1,a,1):
    if isPerfectSquare(a*a - i*i) == True:
        X.append([i,int(math.sqrt(a*a-i*i))])
for i in range(1,b,1):
    if isPerfectSquare(b*b - i*i) == True:
        Y.append([i,int(math.sqrt(b*b-i*i))])
        
cnt = 0 
for i in X:
    for j in Y:
        if i[0]*j[0] + i[1]*j[1] == 0:
            print("YES")
            print(*i)
            print(*[0,0])
            print(*j)
            quit()
            cnt += 1 
        if i[0]*j[0] - i[1]*j[1] == 0:
            print("YES")
            print(*i)
            print(*[0,0])
            print(*[j[0],-j[1]])
            quit()
            cnt += 1 
if cnt == 0:
    print("NO")
    
