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 gcd

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

g = gcd(a,b)

if g == 1:
    print("NO")
    quit()

pair = []
for i in range(1,g):
    for j in range(i, g):
        d2 = i*i + j*j
        if d2 == g*g:
            pair.append(i)
            pair.append(j)
            break
        if d2 > g*g:
            break
    if pair != []:
        break

pa = [a//g * pair[1], -a//g * pair[0]] 
pb = [-b//g * pair[0], -b//g * pair[1]]

if (pa[0] == pb[0]) or (pa[1] == pb[1]):
    pa = [-pa[1], pa[0]]
    pb = [pb[1], -pb[0]]

if pair:
    print("YES") 
    print(0,0)
    print(*pa)
    print(*pb)
else:
    print("NO")