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.util.*;

public class C implements Runnable{
	public static void main (String[] args) {new Thread(null, new C(), "_cf", 1 << 28).start();}

	public void run() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		int a = fs.nextInt(), b = fs.nextInt();
		int ax1 = -1, ax2 = -1;
		int bx1 = -1, bx2 = -1;
		ArrayList<Point> forA = new ArrayList<>();
		ArrayList<Point> forB = new ArrayList<>();
		
		for(int x = 1; x <= 1000; x++) {
			for(int y = x; y <= 1000; y++) {
				if(x*x + y*y == a*a) {
					forA.add(new Point(x, y));
				}
				if(x*x + y*y == b*b) {
					forB.add(new Point(x, y));
				}
			}
		}
		if(forA.isEmpty() || forB.isEmpty()) {
			System.out.println("NO");
			return;
		}

		for(Point p1 : forA) {
			for(Point p2 : forB) {
				for(int i = 0; i < 2; i++) {
					for(int j = 0; j < 2; j++) {
						int tx1 = p1.x, ty1 = p1.y;
						if(i == 1) { tx1 = p1.y; ty1 = p1.x; }
						int tx2 = -p2.x, ty2 = p2.y;
						if(j == 1) { tx2 = -p2.y; ty2 = p2.x; }

						double a1 = Math.toDegrees(Math.atan2(ty1, tx1));
						double a2 = Math.toDegrees(Math.atan2(ty2, tx2));
						double diff = Math.abs(a1-a2);
						if(Math.abs(diff-90) < 1e-7 && tx2 != tx1 && ty2 != ty1) {
							System.out.println("YES");
							System.out.println("0 0");
							System.out.println(tx1 + " " + ty1);
							System.out.println(tx2 + " " + ty2);
							return;
						}

						tx2 *= -1; ty2 *= -1;
						a1 = Math.toDegrees(Math.atan2(ty1, tx1));
						a2 = Math.toDegrees(Math.atan2(ty2, tx2));
						diff = Math.abs(a1-a2);
						if(Math.abs(diff-90) < 1e-7 && tx2 != tx1 && ty2 != ty1) {
							System.out.println("YES");
							System.out.println("0 0");
							System.out.println(tx1 + " " + ty1);
							System.out.println(tx2 + " " + ty2);
							return;
						}


					}
				}		
			}
		}
		
		System.out.println("NO");
		out.close();
	}
	
	class Point {
		int x, y;
		Point(int a, int b) { x = a; y = b; }
	}

	void sort (int[] a) {
		int n = a.length;
		for(int i = 0; i < 50; i++) {
			Random r = new Random();
			int x = r.nextInt(n), y = r.nextInt(n);
			int temp = a[x];
			a[x] = a[y];
			a[y] = temp;
		}
		Arrays.sort(a);
	}

	class FastScanner {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public FastScanner() {
			in = new BufferedInputStream(System.in, BS);
		}

		public FastScanner(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}                
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}

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

	}

}