#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, 1, -1};
int a, b;
int p, q, r, s;
vector<pair<int, int> > u, v;
bool f;
int main() {
  cin >> a >> b;
  if (a > b) swap(a, b);
  for (int i = 1; i < a; ++i) {
    for (int j = 1; j < a; ++j) {
      if (i * i + j * j == a * a) {
        p = i;
        q = j;
        u.push_back(make_pair(p, q));
      }
    }
  }
  for (int i = -b; i < 0; ++i) {
    for (int j = 1; j < b; ++j) {
      if (i * i + j * j == b * b) {
        r = i;
        s = j;
        v.push_back(make_pair(r, s));
      }
    }
  }
  for (int i = (0); i < (u.size()); ++i) {
    for (int j = (0); j < (v.size()); ++j) {
      if (u[i].first * v[j].first + u[i].second * v[j].second == 0 &&
          u[i].second != v[j].second) {
        cout << "YES" << endl;
        cout << "0 0" << endl;
        cout << u[i].first << " " << u[i].second << endl;
        cout << v[j].first << " " << v[j].second << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
