#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int m[1005], ind;
void init() {
  ind = 0;
  for (int i = 0; i < 1001; i++, ind++) {
    m[i] = i * i;
  }
  return;
}
int dir[4][2] = {{1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
int main() {
  init();
  scanf("%d%d", &a, &b);
  a *= a;
  b *= b;
  c = a + b;
  int ai = 0, bi = 0;
  int ax[20], ay[20], bx[20], by[20];
  int flag = 0;
  for (int i = 1; m[i] < a; i++) {
    for (int j = 1; m[i] + m[j] <= a; j++) {
      if (m[i] + m[j] == a) {
        ax[ai] = i, ay[ai++] = j;
        flag = 1;
      }
    }
  }
  if (flag == 1) {
    flag = 0;
    for (int i = 1; m[i] < b; i++) {
      for (int j = 1; m[i] + m[j] <= b; j++) {
        if (m[i] + m[j] == b) {
          bx[bi] = i, by[bi++] = j;
          flag = 1;
        }
      }
    }
    if (flag == 1) {
      flag = 0;
      int a1, a2, b1, b2, c1, c2;
      a1 = a2 = 0;
      for (int i = 0; i < ai && flag == 0; i++) {
        b1 = ax[i];
        b2 = ay[i];
        for (int j = 0; j < bi && flag == 0; j++) {
          for (int k = 0; k < 4; k++) {
            c1 = dir[k][0] * bx[j];
            c2 = dir[k][1] * by[j];
            if (b2 == c2 || b1 == c1) continue;
            if ((b1 - c1) * (b1 - c1) + (b2 - c2) * (b2 - c2) == c) {
              printf("YES\n");
              printf("%d %d\n%d %d\n%d %d\n", a1, a2, b1, b2, c1, c2);
              flag = 1;
              break;
            }
          }
        }
      }
      if (flag == 0) printf("NO\n");
    } else
      printf("NO\n");
  } else
    printf("NO\n");
  return 0;
}
