#include <bits/stdc++.h>
using namespace std;
int fuck[1000010];
struct Point {
  int x, y;
} ans1, ans2;
int main() {
  int i, a, b, x, y, xx, yy, x3, y3, flag = 0, j;
  memset(fuck, 0, sizeof(fuck));
  for (i = 1; i * i <= 1000000; i++) fuck[i * i] = i;
  scanf("%d%d", &a, &b);
  for (i = 1; i * i < a * a; i++) {
    x = i;
    if (fuck[a * a - x * x])
      y = fuck[a * a - x * x];
    else
      continue;
    xx = -y;
    yy = x;
    for (j = 1; j * j < b * b; j++) {
      x3 = j;
      if (fuck[b * b - x3 * x3])
        y3 = fuck[b * b - x3 * x3];
      else
        continue;
      if (y == yy * y3 / abs(yy)) continue;
      if (x3 * abs(yy) == y3 * abs(xx)) {
        flag = 1;
        ans1.x = x;
        ans1.y = y;
        ans2.x = xx * x3 / abs(xx);
        ans2.y = yy * y3 / abs(yy);
        break;
      }
    }
    if (flag == 1) break;
    xx = y;
    yy = -x;
    for (j = 1; j * j < b * b; j++) {
      x3 = j;
      if (fuck[b * b - x3 * x3])
        y3 = fuck[b * b - x3 * x3];
      else
        continue;
      if (x == xx * x3 / abs(xx)) continue;
      if (x3 * abs(yy) == y3 * abs(xx)) {
        flag = 1;
        ans1.x = x;
        ans1.y = y;
        ans2.x = xx * x3 / abs(xx);
        ans2.y = yy * y3 / abs(yy);
        break;
      }
    }
    if (flag == 1) break;
  }
  if (flag == 1) {
    printf("YES\n");
    printf("0 0\n");
    printf("%d %d\n", ans1.x, ans1.y);
    printf("%d %d\n", ans2.x, ans2.y);
  } else
    printf("NO\n");
  return 0;
}
