#include <bits/stdc++.h>
using namespace std;
int gcd(int F, int FF) {
  if (F < FF) swap(F, FF);
  while (FF) {
    int tmp = FF;
    FF = F % FF;
    F = tmp;
  }
  return F;
}
int main() {
  int x, y;
  scanf("%d%d", &x, &y);
  if (x > y) swap(x, y);
  for (int i = 1, _end_ = 1000; i <= _end_; i++) {
    for (int j = 1, _end_ = 1000; j <= _end_; j++) {
      if (i * i + j * j == x * x) {
        int g = gcd(i, j);
        if (y % (x / g) == 0) {
          int p = y / (x / g) * (i / g), q = y / (x / g) * (j / g);
          if (p == j) {
            swap(i, j);
            swap(p, q);
          }
          if (p == j) {
            printf("NO\n");
            return 0;
          }
          printf("YES\n");
          printf("%d %d\n", 0, j);
          printf("%d %d\n", i, 0);
          printf("%d %d\n", i + q, p);
          return 0;
        }
      }
    }
  }
  printf("NO\n");
}
