#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
bool Judge(int x1, int y1, int x2, int y2) {
  if (x1 == 0 || x2 == 0 || x1 == x2)
    return false;
  else if (y1 == 0 || y2 == 0 || y1 == y2)
    return false;
  return true;
}
int main() {
  int a, b;
  while (~scanf("%d%d", &a, &b)) {
    int i, x1, y1, x2, y2;
    for (i = 0; i <= a; i++) {
      x1 = i;
      y1 = (int)sqrt(a * a - i * i);
      if ((double)sqrt(a * a - i * i) - y1 <= eps) {
        if (b * y1 % a != 0 || b * x1 % a != 0) continue;
        x2 = b * y1 / a;
        y2 = b * x1 / a;
        if (Judge(x1, y1, -x2, y2)) {
          printf("YES\n0 0\n%d %d\n%d %d\n", x1, y1, -x2, y2);
          break;
        }
      }
    }
    if (i > a) printf("NO\n");
  }
  return 0;
}
