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.
import math
import random
import sys
import string
input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():                              #For taking string inputs. Actually it returns a List of Characters, instead of a string,
    s = input()                          # which is easier to use in Python, because in Python, Strings are Immutable.
    return(list(s))
def invr():
    return(map(int,input().split())) #For taking space seperated integer variable inputs//

##################################################################################
a,b=invr()
res=[]
if a == 1 or b==1 :
    print("NO")
else:
    res = [(1,1)]
    for x in range(1,a-1):
        y=math.sqrt(a**2-x**2)
        if y==int(y):
            v1=(x,int(y))
            res.append((x+1,int(y+1)))
            break


    v2=()
    for x in range(1-b,b-1):
        y=math.sqrt(b**2-x**2)
        if y==int(y) and v1[0] * x + v1[1] * y == 0:
            res.append((x + 1, int(y + 1)))
            break

    for point in res:
        print(point[0],' ',point[1])






