#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void print(int xa, int ya, int xb, int yb) {
  if (xa == xb || ya == yb || xb == 0 || yb == 0) return;
  cout << "YES" << endl;
  cout << 0 << " " << 0 << endl;
  cout << xa << " " << ya << endl;
  cout << xb << " " << yb << endl;
  exit(0);
}
int main() {
  int a, b;
  cin >> a >> b;
  for (int x = 1; x <= a; x++)
    for (int y = 1; y <= a; y++)
      if (x * x + y * y == a * a) {
        int g = gcd(x, y);
        int dx = x / g, dy = y / g;
        int u = dx * dx + dy * dy;
        int v = b * b;
        if (v % u != 0)
          continue;
        else {
          int p = v / u;
          int k = sqrt(p);
          if (k * k == p) {
            print(x, y, -dy * k, dx * k);
            print(x, y, dy * k, -dx * k);
          }
        }
      }
  cout << "NO" << endl;
  return 0;
}
