#include <bits/stdc++.h>
using namespace std;
int a, b;
int main() {
  while (scanf("%d%d", &a, &b) != EOF) {
    int x1, x2, y1, y2;
    int f = 0;
    for (int i = -b; i <= b; ++i) {
      int s = b * b - i * i;
      if (s <= 0) continue;
      int t = sqrt(s);
      if (t * t == s) {
        x2 = i;
        y2 = t;
      }
      if (((a * x2) % b) != 0 || (a * x2) < b) continue;
      if ((a * y2) % b != 0 | (a * y2) < b) continue;
      y1 = a * x2 / b;
      x1 = a * y2 / b;
      if ((x1 * x2 == y1 * y2 && x1 * x1 + y1 * y1 == a * a &&
               x2 * x2 + y2 * y2 == b * b ||
           x1 > 0 || x2 > 0 || y1 > 0 || y2 > 0) &&
          (y1 != y2)) {
        f = 1;
        break;
      }
    }
    if (f == 0)
      printf("NO\n");
    else {
      printf("YES\n");
      printf("%d %d\n", 0, y1);
      printf("%d %d\n", x1, 0);
      printf("%d %d\n", x1 + x2, y2);
    }
  }
}
