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
def square(a):
    lis=[]
    for k in range(a+1):
        if math.sqrt(a**2-k **2)==int(math.sqrt(a**2-k **2)):
            lis.append((k,int(math.sqrt(a**2-k **2))))
    return lis

def check(a):
    boo=1
    if len(square(a))==2 and int(math.sqrt(a))==math.sqrt(a):
        boo=0
    return boo

a,b=input().split()
a=int(a)

b=int(b)

if check(a)*check(b)==0:
    print('NO')
else:
    v=0
    lisA=[]
    lisB=[]
    lisa=square(a)
    lisb=square(b)
    lisa.remove((a,0))
    lisa.remove((0,a))
    lisb.remove((b,0))
    lisb.remove((0,b))
    for A in lisa:
        for B in lisb:
            if A[0]*B[0]-A[1]*B[1]==0:
                v=1
                lisA.append(A)
                lisB.append(B)

    if v==1:
        print('YES')
        print(0,0)
        print(-int(lisA[0][0]),int(lisA[0][1]))
        print(int(lisB[0][0]),int(lisB[0][1]))
    else:
        print('NO')
        
                
            
    
