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.
# https://codeforces.com/contest/408

import sys
import math

input = lambda: sys.stdin.readline().rstrip()  # faster!

a, b = map(int, input().split())

# first vertice
x1, y1 = 0, 0

# second vertice in quadrant x2 > 0, y2 > 0
# x2**2 + y2**2 = a**2  => y2**2 = a**2 - x2**2
v2 = []
for x2 in range(1, a + 1):
    y2_square = a ** 2 - x2 ** 2
    if y2_square <= 0:
        continue
    y2 = math.isqrt(y2_square)
    if y2 == 0 or y2 ** 2 != y2_square:
        continue
    v2 += [(x2, y2)]

# third vertice in quadrant x2 < 0, y2 > 0
# x3**2 + y3**2 = b**2  => y3**2 = b**2 - x3**2
v3 = []
for x3 in range(-b, 0):
    y3_square = b ** 2 - x3 ** 2
    if y3_square <= 0:
        continue
    y3 = math.isqrt(y3_square)
    if y3 == 0 or y3 ** 2 != y3_square:
        continue
    v3 += [(x3, y3)]

for x2, y2 in v2:
    for x3, y3 in v3:
        if x2 * x3 + y2 * y3 == 0 and y2 != y3:
            print("YES")
            print(x1, y1)
            print(x2, y2)
            print(x3, y3)
            exit()
print("NO")
