#include <bits/stdc++.h>
using namespace std;
long long x1, yy1, x2, yy2, yk1, yk2;
bool check(long long x1, long long yy1, long long x2, long long yy2) {
  if ((x1 == x2) || (x1 == 0) || (x2 == 0)) return false;
  if ((yy1 == yy2) || (yy1 == 0) || (yy2 == 0)) return false;
  return true;
}
int main() {
  long long a, b;
  cin >> a >> b;
  for (x1 = -1000; x1 <= 1000; x1++) {
    yk1 = a * a - x1 * x1;
    yy1 = (long long)sqrt(yk1);
    if (yy1 * yy1 != yk1) continue;
    for (long long x2 = -1000; x2 <= 1000; x2++) {
      yk2 = b * b - x2 * x2;
      yy2 = (long long)sqrt(yk2);
      if (yy2 * yy2 != yk2) continue;
      if (((x2 - x1) * (x2 - x1) + (yy2 - yy1) * (yy2 - yy1) ==
           b * b + a * a) &&
          check(x1, yy1, x2, yy2)) {
        cout << "YES" << endl;
        cout << "0 0" << endl;
        cout << x1 << " " << yy1 << endl;
        cout << x2 << " " << yy2;
        return 0;
      }
    }
  }
  cout << "NO";
  return 0;
}
