#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  cin >> a >> b;
  c = gcd(a, b);
  if (b > a) swap(a, b);
  int x, y;
  x = -1, y = -1;
  for (int i = 1; i <= c; i++) {
    for (int j = 1; j <= c; j++) {
      if (i * i + j * j == c * c) {
        x = i;
        y = j;
        int x1 = x * b / c, y1 = 0, x2 = 0, y2 = y * b / c, x3 = (a / c) * y,
            y3 = y2 + (a / c) * x;
        if (x3 == x1) {
          swap(x, y);
          x1 = x * b / c, y1 = 0, x2 = 0, y2 = y * b / c, x3 = (a / c) * y,
          y3 = y2 + (a / c) * x;
        }
        if (x3 != x1) {
          cout << "YES" << endl;
          cout << x1 << " " << y1 << endl;
          cout << x2 << " " << y2 << endl;
          cout << x3 << " " << y3;
          return 0;
        }
      }
    }
  }
  cout << "NO";
  return 0;
}
