#include <bits/stdc++.h>
int main() {
  int a, b, x;
  scanf("%d %d", &a, &b);
  for (x = 1; x < a; x++) {
    int y = (int)sqrt(a * a - x * x);
    if (x * x + y * y == a * a) {
      if (b * y % a == 0 && b * x % a == 0) {
        int dx = b * y / a;
        int dy = b * x / a;
        if (y == dy) continue;
        printf("YES\n");
        printf("0 0\n");
        printf("%d %d\n", x, y);
        printf("%d %d\n", x + dx, y - dy);
        return 0;
      }
    }
  }
  printf("NO\n");
  return 0;
}
