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.util.Map;
import java.util.List;
import java.util.Scanner;
import java.io.IOException;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.HashMap;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author pedrosorio
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    private Map<Integer, Integer> squares = new HashMap<Integer, Integer>();

    public List<Integer> subSquares(int a2) {
        List<Integer> nums = new ArrayList<Integer>();
        int half = a2/2;
        for (int i = 1; i * i <= half; i++) {
            int left = a2 - i*i;
            if (squares.containsKey(left)) {
                nums.add(i);
                nums.add(squares.get(left));
            }
        }
        return nums;
    }

    public List<Integer> checkPairUtil(int al, int ar, int bl, int br, int cl, int cr) {
        int l2 = (bl-al)*(bl-al);
        int r2 = (br-ar)*(br-ar);
        int cl2 = cl*cl;
        int cr2 = cr*cr;
        if ((l2 == cl2 && r2 == cr2) || (l2 == cr2 && r2 == cl2)) {
            return Arrays.asList(al, ar, bl, br);
        }
        return null;
    }

    public List<Integer> checkPair(int al, int ar, int bl, int br, int cl, int cr) {
        List<Integer> res = null;
        for (int ml=-1; ml < 2; ml += 2) {
            for (int mr=-1; mr < 2; mr += 2) {
                res = checkPairUtil(ml * al, mr * ar, bl, br, cl, cr);
                if (res != null) return res;
                res = checkPairUtil(mr * ar, ml * al, bl, br, cl, cr);
                if (res != null) return res;
            }
        }
        return null;
    }


    public void solve(int testNumber, Scanner in, PrintWriter out) {
        int a,b;
        a = in.nextInt();
        b = in.nextInt();
        for (int i = 0; i <= 1500; i++) {
            squares.put(i*i, i);
        }
        int a2 = a*a;
        int b2 = b*b;
        int c2 = a2+b2;
        List<Integer> numsa = subSquares(a2);
        List<Integer> numsb = subSquares(b2);
        List<Integer> numsc = subSquares(c2);
        List<Integer> res = null;
        for (int i = 0; i < numsc.size() && res == null; i+=2) {
            for (int j = 0; j < numsa.size() && res == null; j+=2) {
                for (int k = 0; k < numsb.size() && res == null; k+=2) {
                    res = checkPair(numsa.get(j), numsa.get(j+1), numsb.get(k), numsb.get(k+1), numsc.get(i), numsc.get(i+1));
                }
            }
        }
        if (res == null) {
            out.println("NO");
        } else {
            out.println("YES");
            out.println("0 0");
            out.println(res.get(0) + " " + res.get(1));
            out.println(res.get(2) + " " + res.get(3));
        }

    }
}

