#include <bits/stdc++.h>
using namespace std;
const int mx = 1e3 + 5;
int dist(pair<int, int> &x, pair<int, int> &y) {
  int dx = x.first - y.first, dy = x.second - y.second;
  return dx * dx + dy * dy;
}
bool right(pair<int, int> &x, pair<int, int> &y, pair<int, int> &z) {
  return dist(x, y) + dist(x, z) == dist(y, z);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int a, b;
  cin >> a >> b;
  pair<int, int> x = make_pair(0, 0), y = make_pair(-1, -1),
                 z = make_pair(-1, -1);
  vector<pair<int, int> > ys;
  for (int i = 1; i < mx; i++) {
    for (int j = 1; j < mx; j++) {
      if (i * i + j * j == a * a) {
        ys.push_back(make_pair(i, j));
      }
    }
  }
  if (ys.empty()) {
    cout << "NO" << endl;
    return 0;
  }
  bool ok = false;
  int k = ys.size();
  for (int c = 0; c < k; c++) {
    pair<int, int> t = ys[c];
    for (int i = 1; i < mx; i++) {
      for (int j = 1; j < mx; j++) {
        pair<int, int> u = make_pair(-i, j);
        if (i * i + j * j == b * b && right(x, t, u) && u.second != t.second) {
          y = t;
          z = u;
          ok = true;
          break;
        }
        if (ok) break;
      }
      if (ok) break;
    }
    if (ok) break;
  }
  if (z == make_pair(-1, -1)) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  cout << x.first << " " << x.second << endl;
  cout << y.first << " " << y.second << endl;
  cout << z.first << " " << z.second << endl;
  return 0;
}
