#include <bits/stdc++.h>
using namespace std;
struct st {
  int x, y, c;
} p[3222222];
int main() {
  int i, j, t = 0;
  for (i = -1000; i <= 1000; i++) {
    for (j = -1000; j <= 1000; j++) {
      if (i != 0 && j != 0) {
        int k = i * i + j * j;
        if (k <= 1000000) {
          p[t].x = i;
          p[t].y = j;
          p[t++].c = k;
        }
      }
    }
  }
  int x[4444], y[4444];
  int a, b;
  while (scanf("%d%d", &a, &b) != -1) {
    int t1 = 0, t2 = 0;
    for (i = 0; i < t; i++) {
      if (p[i].c == a * a) {
        x[t1++] = i;
      }
      if (p[i].c == b * b) {
        y[t2++] = i;
      }
    }
    int flag = 0;
    for (i = 0; i < t1; i++) {
      for (j = 0; j < t2; j++) {
        if (p[x[i]].x * p[y[j]].x + p[x[i]].y * p[y[j]].y == 0 &&
            p[x[i]].x != p[y[j]].x && p[x[i]].y != p[y[j]].y) {
          printf("YES\n");
          printf("0 0\n");
          printf("%d %d\n", p[x[i]].x, p[x[i]].y);
          printf("%d %d\n", p[y[j]].x, p[y[j]].y);
          flag = 1;
          break;
        }
      }
      if (flag) break;
    }
    if (!flag) printf("NO\n");
  }
}
