#include <bits/stdc++.h>
using namespace std;
const int maxn = 1002;
int a, b;
int root[25 * maxn * maxn];
bool tri[5 * maxn];
vector<pair<int, int> > cors[5 * maxn];
void go(int ax, int ay, int bx, int by) {
  cout << "YES" << endl;
  cout << 0 << ' ' << min(ax, ay) << endl;
  cout << max(ax, ay) << ' ' << 0 << endl;
  cout << max(ax, ay) + min(bx, by) << ' ' << max(bx, by) << endl;
}
int main() {
  cin >> a >> b;
  if (a > b) swap(a, b);
  memset(root, -1, sizeof(root));
  for (int i = 0; i < 5 * maxn; i++) {
    root[i * i] = i;
  }
  for (int i = 1; i < maxn; i++) {
    for (int j = i; j < maxn; j++) {
      if (root[i * i + j * j] != -1) {
        tri[root[i * i + j * j]] = true;
        cors[root[i * i + j * j]].push_back(pair<int, int>(i, j));
      }
    }
  }
  if (tri[a] && tri[b]) {
    bool isfind = false;
    double rat = (double)(b) / (double)(a);
    for (int i = 0; i < cors[a].size(); i++) {
      for (int j = 0; j < cors[b].size(); j++) {
        int ax = min(cors[a][i].first, cors[a][i].second),
            ay = max(cors[a][i].first, cors[a][i].second);
        int bx = min(cors[b][j].first, cors[b][j].second),
            by = max(cors[b][j].first, cors[b][j].second);
        if (bx > by) swap(bx, by);
        if (ax > ay) swap(ax, ay);
        if ((double)(by) / (double)(ay)-rat < 0.0000001 &&
            (double)(bx) / (double)(ax)-rat < 0.0000001) {
          isfind = true;
          go(ax, ay, bx, by);
        }
        if (isfind) break;
      }
      if (isfind) break;
    }
    if (!isfind) {
      cout << "NO" << '\n';
    }
  } else {
    cout << "NO" << '\n';
  }
}
