#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  int a, b;
  while (scanf("%d%d", &a, &b) != EOF) {
    int g = gcd(a, b);
    int x = -1, y = -1;
    for (int dx = 1; dx <= 1000; ++dx)
      for (int dy = 1; dy <= 1000; ++dy)
        if (dx * dx + dy * dy == g * g) x = dx, y = dy;
    if (x == -1 && y == -1)
      printf("NO\n");
    else {
      printf("YES\n0 0\n");
      if (a / g * y == b / g * x) swap(a, b);
      printf("%d %d\n", a / g * x, a / g * y);
      printf("%d %d\n", -b / g * y, b / g * x);
    }
  }
  return 0;
}
