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.*;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;

public class CodeForces {

	public void solve() throws IOException {

		int a = nextInt();
		int b = nextInt();
		int aa[] = new int[] { 0, 0 };
		int bb[] = new int[] { 0, 0 };
		int cc[] = new int[] { 0, 0 };

		List<Integer> ar = new ArrayList<Integer>();
		for (int i = 1; i <= a; i++) {
			double t = Math.sqrt(a * a - i * i);
			if (t % 1 == 0 && t != 0) {
				ar.add(i);
			}
		}
		List<Integer> br = new ArrayList<Integer>();
		for (int i = 1; i <= b; i++) {
			double t = Math.sqrt(b * b - i * i);
			if (t % 1 == 0 && t != 0) {
				br.add(i);
			}
		}

		w: for (int i = 0, l = ar.size(); i < l; i++) {
			aa[0] = -ar.get(i);
			aa[1] = (int) Math.sqrt(a * a - aa[0] * aa[0]);
			for (int j2 = 0, l2 = br.size(); j2 < l2; j2++) {
				int b2 = (int) Math.sqrt(b * b - br.get(j2) * br.get(j2));
				if (aa[0] * br.get(j2) + aa[1] * b2 == 0 && b2!=aa[1]) {
					bb[0] = br.get(j2);
					bb[1] = b2;
					break w;
				}

			}
		}

		if (bb[0] != 0) {
			System.out.println("YES");
			System.out.println(0 + " " + 0);
			System.out.println(aa[0] + " " + aa[1]);
			System.out.println(bb[0] + " " + bb[1]);
		} else {
			System.out.println("NO");
		}

	}

	public static void main(String[] args) {
		new CodeForces().run();
	}

	int NOD(int a, int b) {
		while (a != 0 && b != 0) {
			if (a >= b)
				a = a % b;
			else
				b = b % a;
		}
		return a + b;
	}

	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter out;
	boolean isOuterFile = false;

	public void run() {
		try {
			if (isOuterFile) {
				reader = new BufferedReader(new FileReader(
						"C:\\work\\javaprojects\\CodeForces\\SCC.txt"));
				// out = new PrintWriter(new BufferedWriter(new FileWriter(
				// "output.txt")));
				// out = new PrintWriter(System.out);
			} else {
				reader = new BufferedReader(new InputStreamReader(System.in));
				out = new PrintWriter(System.out);
			}

			tokenizer = null;

			// long time = System.currentTimeMillis();
			solve();
			// out.println(System.currentTimeMillis() - time);
			reader.close();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}
}