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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * @author khokharnikunj8
 */

public class Main {
    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                new Main().solve();
            }
        }, "1", 1 << 26).start();
    }

    void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CTriangle solver = new CTriangle();
        solver.solve(1, in, out);
        out.close();
    }

    static class CTriangle {
        private long ck(long a) {
            long b = (long) Math.sqrt(a);
            for (long i = b - 1; i <= b + 1; i++) if (i * i == a) return i;
            return -1;
        }

        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int a = in.scanInt();
            int b = in.scanInt();
            ArrayList<pair> ar1 = new ArrayList<>();
            ArrayList<pair> ar2 = new ArrayList<>();
            for (long i = 1; i <= 1000; i++) {
                for (long j = i + 1; j <= 1000; j++) {
                    if (ck(i * i + j * j) == a) ar1.add(new pair(i, j));
                    if (ck(i * i + j * j) == b) ar2.add(new pair(i, j));
                }
            }

            boolean flag = false;
            for (int i = 0; i < ar1.size() && !flag; i++) {
                for (int j = 0; j < ar2.size() && !flag; j++) {
                    long x1 = ar1.get(i).x;
                    long y1 = ar1.get(i).y;
                    long x2 = ar2.get(j).x;
                    long y2 = ar2.get(j).y;
                    if (a == b) {
                        flag = true;
                        out.println("YES");
                        out.println("0 0");
                        out.println(x1 + " " + y1);
                        out.println((-y1) + " " + x1);
                    } else {
                        if (cmp(x1, y1, -x2, y2)) {
                            flag = true;
                            out.println("YES");
                            out.println("0 0");
                            out.println(x1 + " " + y1);
                            out.println((-x2) + " " + (y2));
                        } else if (cmp(x1, y1, -y2, x2)) {
                            flag = true;
                            out.println("YES");
                            out.println("0 0");
                            out.println(x1 + " " + y1);
                            out.println(-(y2) + " " + x2);
                        } else if (cmp(y1, x1, -x2, y2)) {
                            flag = true;
                            out.println("YES");
                            out.println("0 0");
                            out.println(y1 + " " + x1);
                            out.println((-x2) + " " + y2);
                        } else if (cmp(y1, x1, -y2, x2)) {
                            flag = true;
                            out.println("YES");
                            out.println("0 0");
                            out.println(y1 + " " + x1);
                            out.println((-y2) + " " + x2);
                        } else {
                        }
                    }

                }

            }
            if (!flag) out.println("NO");

        }

        boolean cmp(long a1, long b1, long a2, long b2) {
            return (a1 * a2) == -(b1 * b2) && b1 != (b2);
        }

        class pair {
            long x;
            long y;

            public pair(long x, long y) {
                this.x = x;
                this.y = y;
            }

        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}

