#include <bits/stdc++.h>
using namespace std;
int main() {
  long a, b;
  cin >> a >> b;
  long x1, y1;
  long x2, y2;
  for (x1 = 1; x1 < a; x1++) {
    y1 = floor(sqrt(double(a * a - x1 * x1)));
    if (x1 * x1 + y1 * y1 != a * a) continue;
    for (x2 = 1; x2 < b; x2++) {
      y2 = -floor(sqrt(double(b * b - x2 * x2)));
      if (x2 * x2 + y2 * y2 != b * b) continue;
      if (x1 * x2 + y1 * y2 != 0) continue;
      if ((x1 == x2) || (y1 == y2)) continue;
      cout << "YES" << endl;
      cout << "0 0" << endl;
      cout << x1 << " " << y1 << endl;
      cout << x2 << " " << y2 << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
