#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int a, b;
void print(int x1, int y1, int x2, int y2) {
  if (x1 == x2 || y1 == y2 || x2 == 0 || y2 == 0) return;
  cout << "YES\n";
  cout << 0 << " " << 0 << endl;
  cout << x1 << " " << y1 << endl;
  cout << x2 << " " << y2 << endl;
  exit(0);
}
int main() {
  cin >> a >> b;
  int x1, y1, x2, y2;
  for (x1 = 1; x1 <= a - 1; ++x1)
    for (y1 = 1; y1 <= a - 1; ++y1)
      if (x1 * x1 + y1 * y1 == a * a) {
        int g = gcd(x1, y1);
        x2 = -y1 / g;
        y2 = x1 / g;
        int u = x2 * x2 + y2 * y2;
        int v = b * b;
        if (v % u == 0) {
          int ratio = v / u;
          int k = (int)sqrt((double)(ratio));
          while (k * k < ratio) ++k;
          while (k * k > ratio) --k;
          if (k * k == ratio) {
            print(x1, y1, x2 * k, y2 * k);
            print(x1, y1, -x2 * k, -y2 * k);
          }
        }
      }
  cout << "NO\n";
  return 0;
}
