#include <bits/stdc++.h>
int gcd(int a, int b) {
  while (b) b ^= a ^= b ^= a %= b;
  return a;
}
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if (a > b) {
    swap(a, b);
  }
  int no = 0, i, j;
  int arr[1000][2];
  for (i = 1; i < (a); i++) {
    for (j = i + 1; j < a; j++) {
      if (pow(i, 2) + pow(j, 2) == pow(a, 2)) {
        arr[no][0] = i;
        arr[no][1] = j;
        no++;
      }
    }
  }
  int flag = 0, k, x, nof, qf, s, r, sf, rf;
  for (i = 0; i < no; i++) {
    for (k = 1; k <= 1000; k++) {
      int q = gcd(arr[i][0], arr[i][1]);
      s = arr[i][0] / q;
      r = arr[i][1] / q;
      if ((pow(s, 2) + pow(r, 2)) * pow(k, 2) == pow(b, 2)) {
        flag = 1;
        x = k;
        nof = i;
        qf = q;
        sf = s;
        rf = r;
        break;
      }
    }
  }
  if (!flag) {
    cout << "NO";
    return 0;
  }
  cout << "YES" << endl;
  cout << "0 0" << endl;
  int ka = -1, kb = 1;
  if (sf * qf == rf * x) {
    ka = -1;
    kb = 1;
  }
  if (rf * qf == sf * x) {
    ka = 1;
    kb = -1;
  }
  cout << ka * sf * qf << " " << kb * rf * qf << endl;
  cout << rf * x << " " << sf * x << endl;
  return 0;
}
