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.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Triangle {

	static class Point {
		long x, y;

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

		public long sqDist(Point o) {
			long xDiff = Math.abs(this.x - o.x);
			long yDiff = Math.abs(this.y - o.y);
			return xDiff * xDiff + yDiff * yDiff;
		}

		public boolean diff(Point o) {
			return this.x != o.x && this.y != o.y;
		}

		public void change(int type) {
			this.x = Math.abs(this.x);
			this.y = Math.abs(this.y);
			if (type == 1) {
				this.x *= -1;
			} else if (type == 2) {
				this.x *= -1;
				this.y *= -1;
			} else if (type == 3) {
				this.y *= -1;
			}
		}
	}

	static boolean isPerfect(long x) {
		long y = (long) Math.sqrt(x);
		return y * y == x;
	}

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		sc = new StringTokenizer("");
		int a = nxtInt();
		int b = nxtInt();
		long c2 = a * a + b * b;
		boolean done = false;
		for (long x1 = 1; x1 < a && !done; x1++) {
			long y1 = a * a - x1 * x1;
			if (isPerfect(y1)) {
				y1 = (long) Math.sqrt(y1);
				Point one = new Point(x1, y1);
				for (long x2 = 1; x2 < b && !done; x2++) {
					long y2 = b * b - x2 * x2;
					if (isPerfect(y2)) {
						y2 = (long) Math.sqrt(y2);
						Point two = new Point(x2, y2);
						for (int type = 0; type < 4 && !done; type++) {
							one.change(type);
							two.change((type + 1) % 4);
							if (one.diff(two) && one.sqDist(two) == c2) {
								done = true;
								out.println("YES");
								out.println("0 0");
								out.println(one.x + " " + one.y);
								out.println(two.x + " " + two.y);
							}
						}
					}
				}
			}
		}
		if (!done)
			out.println("NO");
		br.close();
		out.close();
	}

	static BufferedReader br;
	static StringTokenizer sc;
	static PrintWriter out;

	static String nxtTok() throws IOException {
		while (!sc.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null)
				return null;
			sc = new StringTokenizer(s.trim());
		}
		return sc.nextToken();
	}

	static int nxtInt() throws IOException {
		return Integer.parseInt(nxtTok());
	}

	static long nxtLng() throws IOException {
		return Long.parseLong(nxtTok());
	}

	static double nxtDbl() throws IOException {
		return Double.parseDouble(nxtTok());
	}

	static int[] nxtIntArr(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtInt();
		return a;
	}

	static long[] nxtLngArr(int n) throws IOException {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtLng();
		return a;
	}

	static char[] nxtCharArr() throws IOException {
		return nxtTok().toCharArray();
	}
}