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


def is_sum_sq(c):
    c_sq = c * c
    for a in range(1, c):
        b = (c_sq - a * a) ** 0.5
        if b % 1 < 0.0000001:
            b = int(b)
            return min(a, b), max(a, b)
    return None, None


def gcd(a, b):
    if a > b:
        a, b = b, a

    if b % a == 0:
        return a

    return gcd(b % a, a)


x, y = is_sum_sq(a)
if x is None:
    print("NO")
    exit()
g = gcd(x, y)
xg = x // g
yg = y // g
mod_B = (yg * yg + xg * xg) ** 0.5
if b % mod_B != 0:
    print("NO")
    exit(0)

BB_x = int(-yg * (b // mod_B))
BB_y =  int(xg * (b // mod_B))
if BB_x == x or BB_y == y:
    print("NO")
    exit(0)
print("YES")
print(0, 0)
print(x, y)
print(BB_x, BB_y)


    