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.
def search_pair(n):
    pair = []
    for i in range(1,n):
        for j in range(i, n):
            d2 = i*i + j*j
            if d2 == n*n:
                pair.append(i)
                pair.append(j)
                break
            if d2 > n*n:
                break
        if pair != []:
            break
    return pair


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

pair_a = search_pair(a)
pair_b = search_pair(b)

if not pair_a or not pair_b:
    print("NO")
else:
    print("YES")
    if pair_a == pair_b:
        pair_b.reverse()
    print(0, 0)
    print( + pair_a[0], pair_a[1])
    print( - pair_b[0], pair_b[1])

