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 math
EPS = 0.00001

a, b = [int(x) for x in input().split()]
t1, t2 = [], []
for i in range(1, 1000):
    for j in range(i, 1000):
        if (abs(math.sqrt(i * i + j * j) - a) < EPS):
            t1.append([i, j])
for i in range(1, 1000):
    for j in range(i, 1000):
        if (abs(math.sqrt(i * i + j * j) - b) < EPS):
            t2.append([i, j])
if (len(t1) == 0) or (len(t2) == 0):
    print("NO")
    exit()
if (len(t1) == 1) and (len(t2) == 1) and (t1[0] == t2[0]):
    print("NO")
    exit()
print(0, 0)
print(t1[0][0], t1[0][1])
k = 0
while (k < len(t2)) and (t2[k] == t1[0]):
    k += 1
print(-t2[k][1], -t2[k][0])