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.
a,b=list(map(int,input().split()))
c=[]
d=[]
for i in range(1,a):
    if round((a**2-i**2)**0.5)**2==a**2-i**2:
        c.append([i,round((a**2-i**2)**0.5)])
        c.append([round((a**2-i**2)**0.5),i])
for i in range(1,b):
    if round((b**2-i**2)**0.5)**2==b**2-i**2:
        d.append([i,round((b**2-i**2)**0.5)])
        d.append([round((b**2-i**2)**0.5),i])
for i in c:
    z=0
    for j in d:
        if j[0]%i[0]==0 and j[1]%i[1]==0:
            x1,y1=0,0
            x2,y2=i[0],i[1]
            x3,y3=i[0]-j[1],i[1]+j[0]
            if not(x1!=x2 and x1!=x3 and x2!=x3 and y1!=y2 and y1!=y3 and y2!=y3):
                x1,y1=0,0
                x2,y2=i[1],i[0]
                x3,y3=i[1]-j[0],i[0]+j[1]
            print('YES')
            print(x1,y1)
            print(x2,y2)
            print(x3,y3)
            z=1
            break
        if i[0]%j[0]==0 and i[1]%j[1]==0:
            x1,y1=0,0
            x2,y2=j[0],j[1]
            x3,y3=j[0]-i[1],j[1]+i[0]
            if not(x1!=x2 and x1!=x3 and x2!=x3 and y1!=y2 and y1!=y3 and y2!=y3):
                x1,y1=0,0
                x2,y2=j[1],j[0]
                x3,y3=j[1]-i[0],j[0]+i[1]
            print('YES')
            print(x1,y1)
            print(x2,y2)
            print(x3,y3)
            z=1
            break
    if z:
        break
else:
    print('NO')