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
from os import curdir, startfile
import random 
from queue import Queue
import time 
import heapq
import sys 
def main(a,b):


  
  s1=int(math.sqrt(a))
  s2=int(math.sqrt(b))
  for i in range(1,a+1):
    for j in range(1,b+1):

      c,d=i,math.sqrt(a**2-i**2)
      x,y=-1*j,math.sqrt(b**2-j**2)
      
      if d==int(d) and y==int(y) and y!=0 and x!=0 and c!=0 and d!=0:
        
        print(0,0)
        print(c,d)
        print(x,y)
        return 
  print("NO")
  return
a,b=list(map(int,input().split()))
(main(a,b))

   



  