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 collections import defaultdict, deque, Counter
from sys import stdin, stdout
from heapq import heappush, heappop
import math
import io
import os
import math
import bisect

#?############################################################


def isPrime(x):
    for i in range(2, x):
        if i*i > x:
            break
        if (x % i == 0):
            return False
    return True

#?############################################################


def ncr(n, r, p):
    num = den = 1
    for i in range(r):
        num = (num * (n - i)) % p
        den = (den * (i + 1)) % p
    return (num * pow(den, p - 2, p)) % p


#?############################################################

def primeFactors(n):
    l = []
    while n % 2 == 0:
        l.append(2)
        n = n / 2
    for i in range(3, int(math.sqrt(n))+1, 2):
        while n % i == 0:
            l.append(int(i))
            n = n / i
    if n > 2:
        l.append(n)
    return list(set(l))


#?############################################################

def power(x, y, p):
    res = 1
    x = x % p
    if (x == 0):
        return 0
    while (y > 0):
        if ((y & 1) == 1):
            res = (res * x) % p
        y = y >> 1
        x = (x * x) % p
    return res

#?############################################################


def sieve(n):
    prime = [True for i in range(n+1)]
    p = 2
    while (p * p <= n):
        if (prime[p] == True):
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    return prime


#?############################################################

def digits(n):
    c = 0
    while (n > 0):
        n //= 10
        c += 1
    return c

#?############################################################


def ceil(n, x):
    if (n % x == 0):
        return n//x
    return n//x+1

#?############################################################
def isPerfectSquare(n):
    i = 1
    while(i * i<= n):
        if ((n % i == 0) and (n / i == i)):
            return True
        i = i + 1
    return False
        

def pal(aaa):
    mm = []
    aaa = aaa*aaa
    for i in range(1, 1000):
        temp = aaa-(i*i)
        
        if(temp>0):
            # print(i, temp)
            tem = math.sqrt(temp)
            if(isPerfectSquare(temp)):
                mm.append([i, int(tem)])
                
                    
    return mm

def mapin():
    return map(int, input().split())

#?############################################################

a, b = mapin()
xx = pal(a)
yy = pal(b)
for i in range(len(xx)):
    for j in range(len(yy)):
        aa = xx[i]
        bb = yy[j]
        aa.sort()
        bb.sort(reverse = True)
        if(aa[0]*bb[0] == aa[1]*bb[1]):
            
            bb[0] = -bb[0]
            print("YES")
        
            print(0, 0)
            print(*aa)
            print(*bb)
            exit()
            
# print(xx)
# print(yy)
print("NO")
            
        