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 javafx.util.Pair;
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;

import javax.swing.plaf.synth.SynthTabbedPaneUI;
import javax.swing.text.html.HTMLDocument;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

/**
 * Created by LOKESH on 15-12-2017.
 */
public class graphs {


    public static void main(String args[]) throws Exception {

        InputReader in = new InputReader(System.in);
        PrintWriter out  = new PrintWriter(System.out);
        int a = in.nextInt();
        int b = in.nextInt();
        ArrayList<Pair<Integer,Integer>> aa = new ArrayList<>();
        ArrayList<Pair<Integer,Integer>> bb = new ArrayList<>();
        int flaga=0, flagb=0;
        for(int i=1; i<a ;i++){
            int ii = i*i;
            for(int j=1; j<a ;j++){
                if(ii+j*j == a*a){
                    flaga=1;
                    aa.add(new Pair<>(i,j));
                }
            }
        }
        for(int i=1; i<b ;i++){
            int ii = i*i;
            for(int j=1; j<b ;j++){
                if(ii+j*j == b*b){
                    flagb=1;
                    bb.add(new Pair<>(i,j));
                }
            }
        }
        int flag=0;
        if(flaga==0 || flagb==0 || a==1 || b==1){
            out.println("NO");
            flag=1;
        }
        else {
            //out.println("lk");
            for (int i = 0; i < aa.size(); i++) {
                Pair p = aa.get(i);
                int x1 = (int) p.getKey();
                int y1 = (int) p.getValue();
                for (int j = 0; j < bb.size(); j++) {
                    p = bb.get(j);
                    int x2 = (int) p.getKey();
                    int y2 = (int) p.getValue();
                    int z = a * a + b * b;
                    //out.println(x1+" "+y1+" "+x2+" "+y2+"  "+z);
                    if (z == (x1 - x2) * (x1 - x2) + (y1 + y2) * (y1 + y2)) {
                        out.println("YES");
                        out.println("0" + " " + "0");
                        out.println(x1 + " " + y1);
                        if(x1==x2){
                            out.println("-"+x2+" "+y2);
                        }else
                            out.println(x2 + " -" + y2);
                        flag=1;
                        break;
                    }
                }
                if(flag == 1){
                    break;
                }
            }
        }
        if(flag==0) out.println("NO");
        out.flush();
        out.close();
    }
//-------------------------------------------------------------------------------//
    // nth fibonacci no. in logn time

    public static int fib(int n){
        int F[][] = new int[][]{{1,1},{1,0}};
        if(n==0){
            return 0;
        }
        power(F,n-1);
        return F[0][1];
    }
    public static void power(int F[][],int n){
        int M[][] = {{1,1},{1,0}};
        if(n==0 || n==1){
            return;
        }
        power(F,n/2);
        multiply(F,F);

        if(n%2!=0){
            multiply(F,M);
        }
    }
    public static void multiply(int F[][],int M[][]){
        int x =  F[0][0]*M[0][0] + F[0][1]*M[1][0];
        int y =  F[0][0]*M[0][1] + F[0][1]*M[1][1];
        int z =  F[1][0]*M[0][0] + F[1][1]*M[1][0];
        int w =  F[1][0]*M[0][1] + F[1][1]*M[1][1];

        F[0][0] = x;
        F[0][1] = y;
        F[1][0] = z;
        F[1][1] = w;
    }
//---------------------------------------------------------------------------------//
////--------------------------------------------------------------------------------------///////

    public static long modPow(long base, long exp, long mod) {
        base = base % mod;
        long result =1;
        while(exp > 0)
        {
            if(exp % 2== 1)
            {
                result = (result * base) % mod;
                exp --;
            }
            else
            {
                base = (base * base) % mod;
                exp = exp >> 1;
            }

        }
        return result;
    }




//    public static long dfs(ArrayList a[] ,int head, int visited[],long node[]){
//        visited[head]=1;
//        node[head] = 1;
//        for(int i=0;i<a[head].size();i++){
//            Integer lk = (int)(long) a[head].get(i);
//            if(visited[lk]!=1){
//                visited[lk]=1;
//                //System.out.println(head+" S "+count);
//                dfs(a, lk,visited, node);
//                node[head]+=node[lk];
//                //System.out.println(head+" R "+count);
//                //return count;
//            }
//            //return count;
//
//        }
//
//        //System.out.println(head+" R2 "+count);
//        count++;
//        return count;
//    }
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }



    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}
