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 pitagoras(k):
    casos_possiveis = []
    for n in range(1,k):
        for m in range(1,k):
            if((n**2 + m**2) == k**2):
                casos_possiveis.append([n, m])
    return casos_possiveis

def possivelRepresntar(k):
    for n in range(1, k):
        for m in range(1, k):
            if ((n ** 2 + m ** 2) == k ** 2):
                return True

def tangentes(v):
    tangentes = []
    for p in v:
        tangente = p[0]/p[1]
        tangentes.append(tangente)
    return tangentes

def vetorSemRepeticao(v1, v2):
    v = []
    v3 = v1 + v2
    for p in v3:
        if(p not in v):
            v.append(p)
    return v


def vetorUtil(v1, v2):
    v_util = []
    v3 = vetorSemRepeticao(v1,v2)
    for vx in v3:
        if(vx in v1 and vx in v2):
            v_util.append(vx)
    return v_util

a , b  = input()

a = int(a)
b = int(b)

if(possivelRepresntar(a) and possivelRepresntar(b)):
    p1 = pitagoras(a)
    p2 = pitagoras(b)

    t1 = tangentes(pitagoras(a))
    t2 = tangentes(pitagoras(b))

    t_util = vetorUtil(t1, t2)

    if(len(t_util) != 0):

        caso = t_util[0]

        e1 = p1[(t1.index(caso))]
        e2 = p2[(t2.index(1/caso))]
        e4 = [0 ,e1[0]]
        e5 = [e1[1],0]
        e3 = [e1[1]+e2[1], e2[0]]

        print("YES")
        print("{} {}".format(e3[0], e3[1]))
        print("{} {}".format(e4[0], e4[1]))
        print("{} {}".format(e5[0], e5[1]))
    else:
        print("NO")
else:
    print("NO")