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

import math
import functools
@functools.lru_cache(None)
def check(a):
    ans = set()
    for i in range(1, a):
        for j in range(i, a):
            if i ** 2 + j ** 2 == a ** 2:
                ans.add((i, j))
                ans.add((j, i))
    return list(ans)

sq1, sq2 = check(a), check(b)

if sq1 and sq2:
    # print(sq1, sq2)
    for x1, y1 in sq1:
        for x2, y2 in sq2:
            if (x1 * x2) / (y1 * y2) == 1:
                a1, b1 = -x1, y1
                a2, b2 = x2, y2
                if not (a1 == a2 or b1 == b2):
                    print('YES')
                    print(a1, b1)
                    print(0, 0)
                    print(a2, b2)
                    import sys
                    sys.exit()
            elif (x1 * y2) / (x2 * y1) == 1:
                a1, b1 = -x1, y1
                a2, b2 = y2, x2
                if not (a1 == a2 or b1 == b2):
                    print('YES')
                    print(a1, b1)
                    print(0, 0)
                    print(a2, b2)
                    import sys
                    sys.exit()
    print('NO')
else:
    print('NO')
				 	  				  	 	   						   	