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.
def isquare(n):
    h = n
    l = 1
    while h-l>1:
        m = (h+l)//2
        if m*m<=n:
            l = m
        elif m*m>n:
            h = m
    return l
a,b = map(int,input().split())
lsta = []
lstb = []
for i in range(3,a):
    if isquare(a*a-i*i)**2==a*a-i*i:
        lsta.append([i,isquare(a*a-i*i)])
for i in range(3,b):
    if isquare(b*b-i*i)**2==b*b-i*i:
        lstb.append([i,isquare(b*b-i*i)])
flag = False
for p,q in lsta:
    for r,s in lstb:
        if p*r==q*s:
            if q==s:
                p,q,r,s = p,q,r,-s
            else:
                p,q,r,s = p,q,-r,s
            flag = True
            break
        elif p*s==r*q:
            if q==r:
                p,q,s,r = p,q,s,-r
            else:
                p,q,s,r = p,q,-s,r
            flag = True
            break
if flag:
    print("YES\n",0,0,'\n',p,q,'\n',r,s)
else:
    print("NO")