#include <bits/stdc++.h>
using namespace std;
int x, y, t;
vector<int> xa, xb, ya, yb;
int main() {
  scanf("%d%d", &x, &y);
  for (int a = 1; a * a * 2 <= x * x; a++) {
    t = (int)sqrt(x * x - a * a);
    if (a * a + t * t == x * x) {
      xa.push_back(a);
      xb.push_back(t);
    }
  }
  for (int a = 1; a * a * 2 <= y * y; a++) {
    t = (int)sqrt(y * y - a * a);
    if (a * a + t * t == y * y) {
      ya.push_back(a);
      yb.push_back(t);
    }
  }
  for (int a = 0; a < xa.size(); a++)
    for (int b = 0; b < ya.size(); b++) {
      if (xa[a] * yb[b] == xb[a] * ya[b]) {
        if (xa[a] == yb[b]) {
          if (xb[a] == ya[b]) {
          } else {
            printf("YES\n");
            printf("%d %d\n", 0, ya[a]);
            printf("%d %d\n", yb[a], 0);
            printf("%d %d\n", yb[a] + xa[b], xb[b]);
            return 0;
          }
        } else {
          printf("YES\n");
          printf("%d %d\n", 0, xa[a]);
          printf("%d %d\n", xb[a], 0);
          printf("%d %d\n", xb[a] + ya[b], yb[b]);
          return 0;
        }
      }
    }
  printf("NO\n");
  return 0;
}
