#include <bits/stdc++.h>
using namespace std;
map<int, vector<pair<int, int> > > vec;
map<int, bool> has;
void gener() {
  int sum, rt, i, j;
  for (i = 3; i < 1001; i++) {
    for (j = i + 1; j < 1001; j++) {
      sum = (i * i) + (j * j);
      rt = sqrt(sum);
      if (rt * rt == sum) {
        vec[rt].push_back(make_pair(i, j));
        has[rt] = true;
      }
    }
  }
}
bool dis(int x, int y, int z) {
  for (__typeof(vec[x].begin()) i = vec[x].begin(); i != vec[x].end(); i++) {
    for (__typeof(vec[y].begin()) j = vec[y].begin(); j != vec[y].end(); j++) {
      int a = i->first + j->second, b = i->second - j->first;
      if ((a * a) + (b * b) == z) {
        if (i->second == j->first) swap(i, j);
        cout << "YES" << endl;
        printf("%d %d\n", 0, 0);
        printf("%d %d\n", i->first, i->second);
        printf("%d %d\n", -j->second, j->first);
        return true;
      }
    }
  }
  return false;
}
int main() {
  gener();
  int x, y;
  while (cin >> x >> y) {
    if (!dis(x, y, (x * x) + (y * y))) cout << "NO" << endl;
  }
  return 0;
}
