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 *
from tokenize import Pointfloat
def check_paralel(p,k):
    if(p[0] == k[0] or p[1] == k[1]):
        return False
    return True
a,b = map(int,input().split())
ans = False
Ponto = [[0,0]]
Ponto2 = []
if a <= 4 and b <= 4:
    ans = False
else:
    x = 0
    y = 0
    possiveis = []
    for k in range(1,a):
        for p in range(1,a):
            ##print(f"Valores de P {p}, é K {k} ")
            if(dist([k,p],Ponto[0]) == a):
                x = k
                y = p
                ##print(f"Valores de X {x}, é Y{y} ")
                possiveis.append([x,y])
    Ponto.extend(possiveis)
    x = 0
    y = 0
    possiveis = []
    for k in range(-b,b*2):
        for p in range(-b,b*2):
            ##print(f"Valores de P {p}, é K {k} ")
            if(dist([k,p],Ponto[1]) == b):
                x = k
                y = p
                ##print(f"Valores de X {x}, é Y{y} ")
                possiveis.append([x,y])
    Ponto2.extend(possiveis)
##seleciona os 3 pontos
for k in range(1,Ponto.__len__()-1):
    if(check_paralel(Ponto[0],Ponto[k])):
        for p in range(Ponto2.__len__()):
            if(check_paralel(Ponto[0],Ponto[p])):
                if(check_paralel(Ponto[k],Ponto[p])):
                    print("YES")
                    print(str(Ponto[0][0]) + " " + str(Ponto[0][1]))
                    print(str(Ponto[k][0]) + " " + str(Ponto[k][1]))
                    print(str(Ponto2[p][0]) + " " + str(Ponto2[p][1]))
                    exit()
print("NO") 
    