#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  set<int> sq;
  set<int> sq2;
  int a, b, xa = -1, ya = -1, xb = -1, yb = -1, i, j;
  cin >> a >> b;
  for (i = 1; i < a; i++) sq.insert(i * i);
  for (i = 1; i < b; i++) {
    sq2.insert(i * i);
  }
  for (i = 1; i < a; i++) {
    xa = ya = xb = yb = -1;
    if (sq.find(a * a - i * i) != sq.end()) xa = i, ya = sqrt(a * a - i * i);
    if (xa != -1)
      for (j = 1; j < b; j++) {
        if (sq2.find(b * b - j * j) != sq2.end())
          xb = j, yb = sqrt(b * b - j * j);
        if (xb != -1) {
          if (xa * xb == ya * yb) {
            cout << "YES" << endl;
            cout << 0 << " " << 0 << endl;
            cout << xa << " " << ya << endl;
            if (xb == xa)
              xb = -xb;
            else
              yb = -yb;
            cout << xb << " " << yb << endl;
            return 0;
          } else if (xa * yb == xb * ya) {
            cout << "YES" << endl;
            cout << 0 << " " << 0 << endl;
            cout << xa << " " << ya << endl;
            if (xb == ya)
              xb = -xb;
            else
              yb = -yb;
            cout << yb << " " << xb << endl;
            return 0;
          }
        }
      }
  }
  cout << "NO" << endl;
  return 0;
}
