#include <bits/stdc++.h>
bool isSquare(int a) { return a == ((int)sqrt(a) * (int)sqrt(a)); }
bool fin(int x1, int y1, int a, int b) {
  if (x1 * a % b != 0 || y1 * a % b != 0) return false;
  if (x1 == y1 && a == b) return false;
  if (a > b)
    if (y1 > x1) std::swap(y1, x1);
  if (a < b && y1 < x1) std::swap(y1, x1);
  printf("YES\n");
  printf("0 0\n");
  printf("%d %d\n", x1, y1);
  printf("%d %d\n", x1 + y1 * a / b, y1 - x1 * a / b);
  return true;
}
int main() {
  int a, b;
  while (~scanf("%d %d", &a, &b)) {
    bool w = false;
    for (int i = 1; i < (a); i++) {
      if (isSquare(a * a - i * i)) {
        int tmpi = sqrt(a * a - i * i);
        w = fin(i, tmpi, b, a);
        if (w) break;
      }
      if (w) break;
    }
    if (!w) puts("NO");
  }
}
