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 copy
from itertools import combinations
def rev(s):
    a=''
    for i in range (1,len(s)+1):
        a+=s[-i]
    return a

def bse(x,l):
    if len(l)==0:
        return False
    else:
        a=0;b=len(l)-1
        while (b-a)>1:
            mid=(a+b)//2
            if l[mid]>=x:
                b=mid
            else:
                a=mid
        if l[a]==x:
            return a
        elif l[b]==x:
            return b
        else:
            return False
def lb(l,k):
    if len(l)==0:
        return 0
    a=0;b=len(l)-1
    while (b-a>1):
        mid=(a+b)//2
        if l[mid]>=k:
            b=mid
        else:
            a=mid
    if l[a]>=k:
        return a
    elif l[b]>=k:
        return b
    else:
        return len(l)
    
def ub(l,x):
    a=0;b=len(l)-1
    while (b-a)>1:
        mid=(a+b)//2
        if l[mid]>x:
            b=mid
        else:
            a=mid
    if l[a]>x:
        return a
    elif l[b]>x:
        return b
    else:
        return len(l)
def gcd(m,n):
    if m==0 or n==0:
        return m+n
    else:
        return gcd(max(m,n)%min(m,n),min(m,n))

def lcm(m,n):
    if m%n==0 or n%m==0:
        return max(m,n)
    else:
        return (m*n)//gcd(m,n)

def find_fac(n):
    l=[]
    for i in range (1,math.ceil(n**0.5)):
        if n%i==0:
            l.append(i)
            l.append(n//i)
    if int(math.sqrt(n))==math.sqrt(n):
        l.append(int(math.sqrt(n)))
    l=sorted(l)
    return l
def sm_med(l):
    if len(l)%2==0:
        return l[len(l)//2-1]
    else:
        return l[len(l)//2]
def printl(l):
    for i in range(0,len(l)):
        l[i]=str(l[i])
    print(' '.join(l))
    return None
def fastpow(a,b):
    if b==0:
        return 1
    elif b==1:
        return a
    else:
        if b%2==1:
            return fastpow(a,b//2)*fastpow(a,b//2)*a
        else:
            return fastpow(a,b//2)*fastpow(a,b//2)
def distinct_elements(l):
    a={}
    for i in range(0,len(l)):
        a[l[i]]=1
    return len(a)

def isp(n):
    flag=0
    if n==2:
        return True
    else:
        for i in range (2,int(math.sqrt(n)+1)):
            if n%i==0:
                flag=1
                break
        if flag==1:
            return False
        else:
            return True
def sql(n):
    l=[]
    for i in range (1,n+1):
        l.append(i*i)
    return l

#t=int(input())
l=sql(1000)
t=1
for _ in range (0,t):
    n,k=map(int,input().split())
    a=min(n,k);b=max(n,k)
    flag=0
    for i in range (0,a-1):
        if bse(a*a-l[i],l):
            sin=(i+1)/a
            cos=int(math.sqrt(a*a-l[i]))/a
            if b*sin==int(b*sin) and b*cos==int(b*cos):
                flag=-1;break

    if flag==0:
        print("NO")
    else:
        print("YES")
        print(0,0)
        print(int(a*cos),int(a*sin))
        print(int(-b*sin),int(b*cos))
            
    
        
    
    
    
