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.
# from math import sqrt
a, b = list(map(int, input().split()))
def pyth(m, n):
    _a = m * m - n * n
    _b = 2 * m * n
    _c = m * m + n * n
    return (_a, _b, _c)
aans = []
bans = []
for l in [a, b]:
    for i in range(1, l):
        for j in range(i, l):
            triple = pyth(j, i)
            if a in triple:
                aans.append(triple)
            if b in triple:
                bans.append(triple)
if len(aans) == 0 or len(bans) == 0:
    print('NO')
    exit()
else:
    if aans[0] == bans[0]:
        if len(aans) > 1:
            print('YES')
            print('0 0')
            print(aans[1][0], aans[1][1])
            print(bans[0][0], bans[0][1])
        elif len(bans) > 1:
            print('YES')
            print('0 0')
            print(aans[0][0], aans[0][1])
            print(bans[1][0], bans[1][1])
        else:
            print('NO')
    else:
        print('YES')
        print('0 0')
        print(aans[0][0], aans[0][1])
        print(bans[0][0], bans[0][1])
