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(' '))
X1,Y1,X2,Y2=[],[],[],[]
for i in range(-a+1,a) :
    if i == 0 : continue
    x = i
    y = int((a*a - x*x)**0.5+0.1)
    if x**2 + y**2 == a**2 :
        X1.append(x)
        Y1.append(y)
for i in range(-b+1,b) :
    if i == 0 : continue
    x = i
    y = int((b*b - x*x)**0.5+0.1)
    if x**2 + y**2 == b**2 :
        X2.append(x)
        Y2.append(y)

ans_x,ans_y=[],[]
for i in range(len(X1)) :
    for j in range(len(X2)) :
        x1 = X1[i]
        y1 = Y1[i]
        x2 = X2[j]
        y2 = Y2[j]
        if (x1-x2)**2+(y1-y2)**2 == a**2+b**2 :
            ans_x = [x1, x2, 0]
            ans_y = [y1, y2, 0]
            break
if ans_x :
    print("YES")
    for i in range(3) :
        print(str(ans_x[i])+" " + str(ans_y[i]))
else :
    print("NO")