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 numpy import arccos,cos,sin
from math import pi

precision=1e-4
def same(n,m):
    return abs(n-m)<precision

a,b=[int(element)for element in input().split(" ")]

set_a=set()
set_b=set()

def ni(x):
    if x%1>1/2:
        return x//1+1
    else:
        return x//1
for x in range(a+1):
    if sqrt(a**2-x**2)%1==0:
        theta=arccos(x/a)
        liste=[theta,theta+pi/2,theta+pi,theta-pi/2]
        for element in liste:
            if element%(pi/2):
                set_a.add(element)

for y in range(b+1):
    if sqrt(b**2-y**2)%1==0:
        theta=arccos(y/b)
        liste=[theta,theta+pi/2,theta+pi,theta-pi/2]
        for element in liste:
            if element%(pi/2):
                set_b.add(element)

bool=False
for angle1 in set_a:
    if not bool:
        for angle2 in set_b:
            if same(abs(angle1-angle2),pi/2):
                liste=[a*cos(angle1),a*sin(angle1),b*cos(angle2),b*sin(angle2)]
                x1,y1,x2,y2=[ni(element) for element in liste]

                bool=True
                break
    else:
        break

if bool:
    answer=['YES','0 0',str(x1)+' '+str(y1),str(x2)+' '+str(y2)]
else:
    answer=['NO']
print(('\n').join(answer))