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 sql(n):
    l=[]
    for i in range (1,n+1):
        l.append(i*i)
    return l

#t=int(input())
l=sql(1000)
t=1
for _ in range (0,t):
    n,k=map(int,input().split())
    a=min(n,k);b=max(n,k)
    flag=0
    for i in range (0,a-1):
        if bse(a*a-l[i],l):
            sin=(i+1)/a
            cos=int(math.sqrt(a*a-l[i]))/a
            if b*sin==int(b*sin) and b*cos==int(b*cos):
                flag=-1;break

    if flag==0:
        print("NO")
    else:
        print("YES")
        print(0,0)
        print(int(a*cos),int(a*sin))
        print(int(-b*sin),int(b*cos))
