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 fractions

def square_prime(n):
    p = 2
    while (n != 1):
        if (n%p == 0):
            if(p%4 == 1):
                return p
            n = n/p
        else:
            p += 1
    return -1

s = str(input())
s = s.split(' ')

a = int(s[0])
b = int(s[1])

c = fractions.gcd(a, b)
p = square_prime(c)

if (p == -1):
    print("NO")
else:
    c = 0
    s = 0

    x = 0
    y = 0
    while (x < p and x*x < p and c==0 and s==0):
        x2 = x*x
        y2 = p - x2

        y = 0
        while (y < y2 and y*y <= y2):
            if (y*y == y2):
                c = x2 - y2
                s = 2*x*y
                break
            y += 1
        x += 1

    print("YES")
    print("0 0")
    print(str(int(a*c/p)) + " " + str(int(a*s/p)))
    print(str(int(-b*s/p)) + " " + str(int(b*c/p)))
