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.
inp = input().split()
a = int(inp[0])
b = int(inp[1])

ag = 0
bg = 0

can = 'NO'

def calcw(a):
    for i in range(1, a+1):
        for j in range(a-i+1, a+1):
            #print(i, j)
            if (a**2 == i**2 + j**2):
                return (i, j)
    return 0



#ah =  (ag[0]**2 + ag[1]**2)**0.5
#bh =  (bg[0]**2 + bg[1]**2)**0.5
#hyp = (bh**2 + ah**2)**0.5


#print(bg)
#print(hyp)
ag = calcw(a)
bg = calcw(b)

if ag!=0 and bg!=0:
    can = 'YES'
    print(0, 0)
    print(ag[0], ag[1])
    print(bg[1], bg[0])
print(can)
