#include <bits/stdc++.h>
using namespace std;
int a, b;
int as[1010][2], bs[1010][2];
int p, q;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> a >> b;
  for (int x = 1; x < a; x++) {
    int y = (int)sqrt(a * a - x * x);
    if (x * x + y * y == a * a) {
      as[p][0] = x;
      as[p++][1] = y;
    }
  }
  for (int x = 1; x < b; x++) {
    int y = (int)sqrt(b * b - x * x);
    if (x * x + y * y == b * b) {
      bs[q][0] = x;
      bs[q++][1] = y;
    }
  }
  for (int i = 0; i < p; i++) {
    for (int j = 0; j < q; j++) {
      if (as[i][1] != bs[j][1] &&
          -as[i][0] * bs[j][0] + as[i][1] * bs[j][1] == 0) {
        cout << "YES" << '\n';
        cout << "0 0" << '\n';
        cout << -as[i][0] << " " << as[i][1] << '\n';
        cout << bs[j][0] << " " << bs[j][1] << '\n';
        return 0;
      }
    }
  }
  cout << "NO" << '\n';
  return 0;
}
