#include <bits/stdc++.h>
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  int a1[1000 + 10], b1[1000 + 10], a2[1000 + 10], b2[1000 + 10];
  int len1 = 0, len2 = 0;
  for (int i = 1; i * i < a * a; i++) {
    for (int j = i + 1;; j++) {
      if (i * i + j * j > a * a) break;
      if (i * i + j * j == a * a) a1[len1] = i, b1[len1++] = j;
    }
  }
  for (int i = 1; i * i < b * b; i++) {
    for (int j = i + 1;; j++) {
      if (i * i + j * j > b * b) break;
      if (i * i + j * j == b * b) a2[len2] = i, b2[len2++] = j;
    }
  }
  int flag = 0;
  int ansi, ansj;
  for (int i = 0; i < len1; i++) {
    for (int j = 0; j < len2; j++) {
      double k1 = a1[i], m1 = b1[i];
      double k2 = a2[j], m2 = b2[j];
      if (a1[i] == b2[j] && b1[i] == a2[j]) continue;
      if (b1[i] == a2[j]) {
        a1[i] = a1[i] + b1[i];
        b1[i] = a1[i] - b1[i];
        a1[i] = a1[i] - b1[i];
        a2[j] = a2[j] + b2[j];
        b2[j] = a2[j] - b2[j];
        a2[j] = a2[j] - b2[j];
      }
      if (k1 / k2 == m1 / m2) {
        flag = 1;
        ansi = i;
        ansj = j;
      }
      if (flag == 1) break;
    }
    if (flag == 1) break;
  }
  if (flag == 0)
    puts("NO");
  else {
    puts("YES");
    puts("0 0");
    printf("%d %d\n", -a1[ansi], b1[ansi]);
    printf("%d %d\n", b2[ansj], a2[ansj]);
  }
  return 0;
}
