#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
inline T LCM(T a, T b) {
  if (a < 0) return LCM(-a, b);
  if (b < 0) return LCM(a, -b);
  return a * (b / gcd(a, b));
}
vector<pair<int, int> > x, y;
int main() {
  int a, b, u, v;
  cin >> a >> b;
  for (int i = (int)1; i < (int)a; ++i) {
    u = a * a - i * i;
    v = sqrt(u);
    if (v * v == u) x.push_back(make_pair(i, v));
  }
  for (int i = (int)1; i < (int)b; ++i) {
    u = b * b - i * i;
    v = sqrt(u);
    if (v * v == u) y.push_back(make_pair(-i, v));
  }
  for (int i = (int)0; i < (int)int((x).size()); ++i) {
    for (int j = (int)0; j < (int)int((y).size()); ++j) {
      if (x[i].first * y[j].first == x[i].second * y[j].second * (-1) &&
          (x[i].second != y[j].second && x[i].first != y[j].first)) {
        printf("YES\n");
        printf("0 0\n%d %d\n%d %d\n", x[i].first, x[i].second, y[j].first,
               y[j].second);
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
