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
a,b = map(int, input().split())

x1 = y1 = 0
for m in range(1,a+1):
    ns = a - m**2
    if ns <= 0:
        break
    n = math.sqrt(ns)
    if n - int(n) < 1e-10:
        n = int(n)
        x1 = m*m - n*n
        y1 = 2*m*n
        break

x2 = y2 = 0
for m in range(1,b+1):
    ns = b - m**2
    if ns <= 0:
        break
    n = math.sqrt(ns)
    if n - int(n) < 1e-10:
        n = int(n)
        x2 = m*m - n*n
        y2 = 2*m*n
        break

if x1 == y1 or x2 == y2:
    print('NO')
else:
    print('YES')
    print('0 0')
    x1,y1 = min(x1,y1), max(x1,y1)
    y2,x2 = min(x2,y2), max(x2,y2)
    print('%i %i' % (abs(x1),abs(y1)))
    print('%i %i' % (x2,y2))