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






#print(bg)
#print(hyp)
ag = calcw(a)
bg = calcw(b)
ag1 = -ag[0], ag[1]
ag2 = ag[0], -ag[1]
bg1 = -bg[0], bg[1]
bg2 = bg[0], -bg[1]
bg3 = bg[1], bg[0]
bg4 = bg[1], -bg[0]
bg5 = -bg[1], bg[0]

ags = (ag, ag1, ag2)
bgs = (bg, bg1, bg2, bg3, bg4, bg5)

can = 'NO'

def do():
    global can
    for i in ags:
        for j in bgs:
            x1 = i[0]
            y1 = i[1]
            x2 = j[0]
            y2 = j[1]

            l1 =  (x1**2 + y1**2)**0.5
            l2 =  (x2**2 + y2**2)**0.5
            hyp = (l1**2 + l2**2)**0.5
            print(x1, y1)
            print(x2, y2)
            print(l1, l2)
            print(hyp)
            print('----------HATE----------')

            if (hyp == ((x1-x2)**2 + (y1-y2)**2)**0.5) and x1 != x2 and y1 != y2:
                can = 'YES'
                print(can)
                print(0, 0)
                print(x1, y1)
                print(x2, y2)
                return
if not (ag == 0 or bg == 0):
    do()
if can == 'NO':
    print(can)
