#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long a, b, x, y, x1, x2, y1, y2, i, j, s, f;
  cin >> a >> b;
  a = a * a;
  x1 = -1;
  y1 = -1;
  vector<pair<int, int>> v1;
  for (i = 1; i <= a - 1; i++) {
    x = sqrt(i);
    y = sqrt(a - i);
    if (x * x == i && y * y == (a - i)) {
      v1.push_back({x, y});
    }
  }
  b = b * b;
  x2 = -1;
  y2 = -1;
  vector<pair<int, int>> v2;
  for (i = 1; i <= b - 1; i++) {
    x = sqrt(i);
    y = sqrt(b - i);
    if (x * x == i && y * y == (b - i)) {
      v2.push_back({x, y});
    }
  }
  s = a + b;
  f = 0;
  for (i = 0; i < v1.size(); i++) {
    x1 = v1[i].first;
    y1 = v1[i].second;
    for (j = 0; j < v2.size(); j++) {
      x2 = v2[j].first;
      y2 = -v2[j].second;
      if (((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) == s) && x1 != x2) {
        f = 1;
        break;
      }
      x2 = v2[j].second;
      y2 = -v2[j].first;
      if (((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) == s) && x1 != x2) {
        f = 1;
        break;
      }
    }
    if (f == 1) break;
  }
  if (f == 0)
    cout << "NO" << endl;
  else {
    cout << "YES" << endl;
    cout << 0 << " " << 0 << endl;
    cout << x1 << " " << y1 << endl;
    cout << x2 << " " << y2 << endl;
  }
  return 0;
}
