#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
int l[2];
vector<pair<int, int> > v[2];
void fill(int i) {
  for (int x = -l[i]; x <= l[i]; x++) {
    for (int y = -l[i]; y <= l[i]; y++) {
      if (x * x + y * y == l[i] * l[i]) {
        v[i].push_back(make_pair(x, y));
      }
    }
  }
}
bool ok(int i, int j) {
  int x1 = v[0][i].first;
  int y1 = v[0][i].second;
  int x2 = v[1][j].first;
  int y2 = v[1][j].second;
  bool res = true;
  res &= (x1 != 0 && x2 != 0 && y1 != 0 && y2 != 0);
  res &= (x1 * x2 + y1 * y2 == 0);
  res &= (x1 != x2 && y1 != y2);
  return res;
}
int main() {
  cin >> l[0] >> l[1];
  for (int i = 0; i < (int)2; i++) fill(i);
  for (int i = 0; i < (int)v[0].size(); i++) {
    for (int j = 0; j < (int)v[1].size(); j++) {
      if (ok(i, j)) {
        cout << "YES" << endl;
        cout << 0 << " " << 0 << endl;
        cout << v[0][i].first << " " << v[0][i].second << endl;
        cout << v[1][j].first << " " << v[1][j].second << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
