#include <bits/stdc++.h>
using namespace std;
int a, b, xa, ya, xb, yb;
int main() {
  scanf("%d%d", &a, &b);
  int bord = sqrt(a * a);
  for (xa = 1; xa < bord; xa++) {
    int sum = (a - xa) * (a + xa);
    ya = sqrt(sum);
    if (ya * ya + xa * xa == a * a) {
      yb = b * xa / a;
      xb = -ya * yb / xa;
      if (xb * xb + yb * yb == b * b) {
        printf("YES\n");
        printf("%d %d\n", 0, 0);
        if (ya == yb) {
          yb = -yb;
          xb = -xb;
        }
        printf("%d %d\n", xa, ya);
        printf("%d %d\n", xb, yb);
        return 0;
      }
    }
  }
  printf("NO");
  return 0;
}
