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 sqrt

def dist(A, B):
    x = A[0] - B[0]
    y = A[1] - B[1]
    return sqrt(x**2 + y**2)

def is_int(gip, kat):
    if not sqrt(gip**2 - kat**2)%1:
        return True
    else:
        return False

A = 0, 0
B = 0, 0
C = 0, 0

a, b = list(map(int, input().split()))
#a, b = 5, 5
#print(a, b)
result = 'NO'

for x in range(A[0]+1, A[0]+a):
    if is_int(a, x):
        B = x, int(sqrt(a**2 - x**2))

        cos = B[1]/a
        #print(cos)
        newx = cos*b
        #print(newx%1)
        if not newx%1:
            C = -int(newx), int(sqrt(b**2 - newx**2))
            result = 'YES'
        #print(A, B, C)
    #print(x)

print(result)
if result == 'YES':
    print(A[0], A[1])
    print(B[0], B[1])
    print(C[0], C[1])
