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.
from math import floor
def gca(a,b):
    while(1):
        a%=b
        if a==0: return b
        b%=a
        if b==0: return a
yes=1
x,y=map(int,input().split())
if x>y: x,y=y,x
a,b=0,0
r=y//gca(x,y)
r2=x//gca(x,y)
x=gca(x,y)
for i in range(2,x):
    if round((x*x-i*i)**(1/2))**2==x*x-i*i:
        a,b=i,round((x*x-i*i)**(1/2))
        break
if a==0 or b==0: yes=0
if yes:
    print("YES")
    print(0,0)
    print(r2*a,r2*b)
    if r2*a-r*b!=0: print(r2*a-r*b,r2*b+r*a)
    else: print(r2*a-r*a,r2*b+r*b)
else: print("NO")