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 solv(a,b):
  n = max(a,b)
  S = [i*i for i in range(1,n)]
  D = {i:[] for i in range(1,4*n*n+1)}
  for i in range(1,n):
    for j in range(i,n):
      D[i*i+j*j].append([i,j])
  L1 = D[a*a]
  L2 = D[b*b]
  if not L1: return ["NO"]
  if not L2: return ["NO"]
  for a1,a2 in L1:
    for b1,b2 in L2:
      if a1*b2 == a2*b1:
        return ["YES","0 0","%s %s"%(a1,a2),"%s %s"%(-b2,b1)]
  return ["NO"]
  
a,b = map(int,input().split())
[print(s) for s in solv(a,b)]
