#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000009;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int MAXN = 1003;
const int MAXM = 0;
int a, b, i, l, d, x, y, j, xx, yy;
vector<pair<int, int> > v1;
vector<pair<int, int> > v2;
int main() {
  cin >> a >> b;
  for (i = 1; i * i < a * a; i++) {
    d = a * a - i * i;
    l = int(sqrt(d) + eps);
    if (l * l == d) v1.push_back(make_pair(i, l));
  }
  for (i = 1; i * i < b * b; i++) {
    d = b * b - i * i;
    l = int(sqrt(d) + eps);
    if (l * l == d) v2.push_back(make_pair(i, l));
  }
  for (i = 0; i < v1.size(); i++)
    for (j = 0; j < v2.size(); j++) {
      x = v1[i].first;
      y = v1[i].second;
      xx = v2[j].first;
      yy = v2[j].second;
      if (x == y && y == xx && xx == yy) continue;
      if (x * xx != y * yy) continue;
      if (x == xx)
        xx = -xx;
      else
        yy = -yy;
      cout << "YES" << endl;
      cout << "0 0" << endl
           << x << " " << y << " " << endl
           << xx << " " << yy << endl;
      return 0;
    }
  cout << "NO" << endl;
  return 0;
}
