#include <bits/stdc++.h>
using namespace std;
int SquareRoot(int n) {
  int l = 1, r = n + 1;
  while (l < r) {
    int mid = (l + r) / 2;
    if (n / mid < mid) {
      r = mid;
    } else {
      l = mid + 1;
    }
  }
  --l;
  if (l * l == n) {
    return l;
  }
  return -1;
}
int GCD(int a, int b) {
  while (b > 0) {
    int t = a % b;
    a = b;
    b = t;
  }
  return a;
}
int main() {
  int a = 0, b = 0;
  scanf("%d%d", &a, &b);
  int a2 = a * a;
  int b2 = b * b;
  bool found = false;
  for (int i = a - 1; i > 0; --i) {
    int j = SquareRoot(a2 - i * i);
    if (j < 0) {
      continue;
    }
    int gcd = GCD(i, j);
    int i_norm = i / gcd;
    int j_norm = j / gcd;
    int squ = i_norm * i_norm + j_norm * j_norm;
    if (b2 % squ != 0) {
      continue;
    }
    int mul = SquareRoot(b2 / squ);
    if (mul < 0) {
      continue;
    }
    found = true;
    int i2 = i_norm * mul;
    int j2 = j_norm * mul;
    if (i2 == j) {
      continue;
    }
    printf("YES\n");
    printf("0 0\n");
    printf("%d %d\n", i, j);
    printf("%d %d\n", -j2, i2);
    break;
  }
  if (!found) {
    printf("NO\n");
  }
  return 0;
}
