#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-8;
int main() {
  int a, b;
  while (scanf("%d%d", &a, &b) != EOF) {
    int j, i;
    if (a < b) swap(a, b);
    for (i = 1; i < b; i++) {
      j = sqrt(b * b - i * i);
      if (j * j + i * i == b * b && (a * i) % b == 0 && (a * j) % b == 0 &&
          (j != (a * i) / b))
        break;
    }
    if (i == b)
      printf("NO\n");
    else {
      printf("YES\n0 0\n");
      printf("%d %d\n%d %d\n", (a * i) / b, (a * j) / b, j, 0 - i);
    }
  }
  return 0;
}
