#include <bits/stdc++.h>
using namespace std;
const string r = "239";
const string p = "c";
const int maxxy = 1500;
long long sqr(long long a) { return (a * a); }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  long long a, b;
  cin >> a >> b;
  long long xc = 0, yc = 0;
  for (long long xb = -maxxy; xb <= maxxy; xb++)
    for (long long yb = -maxxy; yb <= maxxy; yb++)
      if (xb != 0 && yb != 0 && sqr(xb) + sqr(yb) == sqr(a)) {
        if ((sqr(b) * sqr(xb)) % (sqr(xb) + sqr(yb)) != 0) continue;
        long long tmp = (sqr(b) * sqr(xb)) / (sqr(xb) + sqr(yb));
        if (tmp < 0) continue;
        yc = trunc(sqrt(tmp));
        if (sqr(yc) != tmp) continue;
        if ((yb * yc) % xb != 0) continue;
        xc = -(yb * yc) / xb;
        if (xb == 0 || xc == 0 || xb == xc || yb == 0 || yc == 0 || yb == yc)
          continue;
        cout << "YES\n0 0\n";
        cout << xb << " " << yb << "\n";
        cout << xc << " " << yc << "\n";
        return 0;
      }
  cout << "NO";
}
