#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  vector<int> mark(a * a, 0), mark2(b * b, 0);
  int i, j;
  for (i = 1; i * i < a * a; i++) {
    mark[i * i] = i;
  }
  for (i = 1; i * i < b * b; i++) {
    mark2[i * i] = i;
  }
  int flag = 0, x1 = 0, x2 = 0;
  vector<pair<int, int> > f;
  for (i = 1; i * i < (a * a); i++) {
    if (mark[i * i] && mark[a * a - i * i]) {
      f.push_back(make_pair(i, mark[a * a - i * i]));
      f.push_back(make_pair(-i, mark[a * a - i * i]));
      f.push_back(make_pair(i, -mark[a * a - i * i]));
      f.push_back(make_pair(-i, -mark[a * a - i * i]));
    }
  }
  vector<pair<int, int> > s;
  for (i = 1; i * i < b * b; i++) {
    if (mark2[i * i] && mark2[b * b - i * i]) {
      s.push_back(make_pair(i, mark2[b * b - i * i]));
      s.push_back(make_pair(-i, mark2[b * b - i * i]));
      s.push_back(make_pair(i, -mark2[b * b - i * i]));
      s.push_back(make_pair(-i, -mark2[b * b - i * i]));
    }
  }
  for (i = 0; i < f.size(); i++) {
    for (j = 0; j < s.size(); j++) {
      if (f[i].first != s[j].first && f[i].second != s[j].second) {
        if ((s[j].second - f[i].second) * (s[j].second - f[i].second) +
                (s[j].first - f[i].first) * (s[j].first - f[i].first) ==
            (a * a + b * b)) {
          cout << "YES" << endl;
          cout << "0 0" << endl
               << f[i].first << " " << f[i].second << endl
               << s[j].first << " " << s[j].second;
          return 0;
        }
      }
    }
  }
  cout << "NO";
  return 0;
}
