#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int a, b;
bool ok(int x1, int y1, int &x2, int &y2) {
  auto sqr = [&](ll x) { return x * x; };
  ll d =
      sqr(x1 * sqr(a)) - sqr(a) * (sqr(sqr(a)) - sqr(y1) * (sqr(a) + sqr(b)));
  if (d < 0) return false;
  ll dd = (ll)sqrt(d);
  if (dd * dd != d) return false;
  if (dd % sqr(a) != 0) return false;
  x2 = x1 + dd / sqr(a);
  ll t = sqr(a) - x1 * x2;
  if (t % y1 == 0) {
    y2 = t / y1;
    if (x1 && x2 && y1 && y2 && x1 != x2 && y1 != y2) return true;
  }
  x2 = x1 - dd / sqr(a);
  t = sqr(a) - x1 * x2;
  if (t % y1 == 0) {
    y2 = t / y1;
    if (x1 && x2 && y1 && y2 && x1 != x2 && y1 != y2) return true;
  }
  return false;
}
int main() {
  scanf("%d%d", &a, &b);
  for (int x1 = 0; x1 < a; ++x1) {
    int t = a * a - x1 * x1;
    int y1 = (int)sqrt(t), x2, y2;
    if (y1 * y1 == t) {
      if (ok(x1, y1, x2, y2))
        return printf("YES\n%d %d\n%d %d\n%d %d\n", 0, 0, x1, y1, x2, y2), 0;
      if (ok(x1, -y1, x2, y2))
        return printf("YES\n%d %d\n%d %d\n%d %d\n", 0, 0, x1, -y1, x2, y2), 0;
    }
  }
  puts("NO");
  return 0;
}
