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.

Input

The first line contains two integers a, b (1 ≤ a, b ≤ 1000), separated by a single space.

Output

In the first line print either "YES" or "NO" (without the quotes) depending on whether the required location exists. If it does, print in the next three lines three pairs of integers — the coordinates of the triangle vertices, one pair per line. The coordinates must be integers, not exceeding 109 in their absolute value.

Examples

Input

1 1


Output

NO


Input

5 5


Output

YES
2 1
5 5
-2 4


Input

5 10


Output

YES
-10 4
-2 -2
1 2
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {public static void main(String[] args) throws Exception {new Solve();}}

class Solve { public Solve() throws Exception {solve();}
    void solve() throws Exception {
        int a = NI();
        int b = NI();
        ArrayList<Integer> aC = new ArrayList<>();
        ArrayList<Integer> bC = new ArrayList<>();
        for (int i = 1; i < 1000 && i * i < a * a; i++) {
            double t = Math.sqrt(a * a - i * i);
            if (t - (int) t == 0.0) {
                aC.add(i);
                aC.add((int)t);
            }
        }

        for (int i = 1; i < 1000 && i * i < b * b; i++) {
            double t = Math.sqrt(b * b - i * i);
            if (t - (int) t == 0.0) {
                bC.add(i);
                bC.add((int)t);
            }
        }

        if (aC.size() < 2 || bC.size() < 2) {
            System.out.println("NO");
            return;
        }

        for (int i = 0; i < aC.size(); i++) {
            for (int j = 0; j < bC.size(); j++) {
                int s = aC.get(i) + bC.get(j);
                int d = abs(aC.get(i + (i % 2 == 0 ? 1 : -1)) - bC.get(j + (j % 2 == 0 ? 1 : -1)));
                if (d != 0 && a * a + b * b == s * s + d * d) {
                    System.out.println("YES");
                    System.out.println(bC.get(j) + " 0");
                    System.out.println(s + " " + aC.get(i + (i % 2 == 0 ? 1 : -1)));
                    System.out.println("0 " + bC.get(j + (j % 2 == 0 ? 1 : -1)));
                    return;
                }
            }
        }
        System.out.println("NO");
    }

    class Pair {
        int i, j;
        char c;
        Pair(int a, int b, char c) {
            i = a;
            j = b;
            this.c = c;
        }
    }

    static BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st=new StringTokenizer("");
    static Scanner sc = new Scanner(System.in);
    int min(int i1,int i2){return i1<i2?i1:i2;}
    long min(long i1,long i2){return i1<i2?i1:i2;}
    int max(int i1,int i2){return i1>i2?i1:i2;}
    long max(long i1,long i2){return i1>i2?i1:i2;}
    String NS()throws Exception{while(!st.hasMoreTokens())st=new StringTokenizer(stdin.readLine());return st.nextToken();}
    String NLn() throws Exception {return stdin.readLine();}
    int NI()throws Exception{return Integer.parseInt(NS());}
    long NL()throws Exception{return Long.parseLong(NS());}
    double ND()throws Exception{return Double.parseDouble(NS());}
    int abs(int x){return x<0?-x:x;}
}
class ArrayUtils{public static void mergeSort(long[]a){long[]src=a.clone();mergeSortInt(src, a, 0, a.length);}
    public static void mergeSortInt(long[]src,long[]dest,int low,int high) {
        int length = high - low;
        if(length == 1)
            return;
        if (length == 2) {
            if(dest[low] > dest[high-1]){
                long t = dest[low];
                dest[low] = dest[high-1];
                dest[high-1] = t;
            }
            return;
        }
        int mid = (low + high) >>> 1;
        mergeSortInt(dest, src, low, mid);
        mergeSortInt(dest, src, mid, high);
        for(int i = low, p = low, q = mid; i < high; i++)
            if (q >= high || p < mid && src[p] <= src[q])
                dest[i] = src[p++];
            else
                dest[i] = src[q++];
    }

}