#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > ls[1011];
void init() {
  for (int x = (1), _b = (1000); x <= _b; x++)
    for (int y = (1), _b = (1000); y <= _b; y++) {
      int a = (int)(round(sqrt(x * x + y * y) + 1e-6));
      if (x * x + y * y == a * a && a <= 1000) {
        ls[a].push_back(make_pair(x, y));
      }
    }
}
bool good;
void output(int ax, int ay, int bx, int by) {
  good = true;
  cout << "YES\n";
  cout << 0 << ' ' << 0 << endl;
  cout << ax << ' ' << ay << endl;
  cout << bx << ' ' << by << endl;
}
int main() {
  ios ::sync_with_stdio(false);
  init();
  int a, b;
  while (cin >> a >> b) {
    good = false;
    for (int ia = 0, _a = (ls[a].size()); ia < _a; ia++)
      for (int ib = 0, _a = (ls[b].size()); ib < _a; ib++) {
        if (good) break;
        int ax = ls[a][ia].first, ay = ls[a][ia].second;
        int bx = ls[b][ib].first, by = ls[b][ib].second;
        if (ax * bx == ay * by && ay != by) {
          output(ax, ay, -bx, by);
          continue;
        }
        if (ax * bx == ay * by && ax != bx) {
          output(ax, ay, bx, -by);
          continue;
        }
      }
    if (!good) cout << "NO\n";
  }
  return 0;
}
