#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, i, j;
  cin >> a >> b;
  if (a < b) {
    i = a;
    a = b;
    b = i;
  }
  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)
    cout << "NO";
  else
    cout << "YES\n0 0\n"
         << (i * a) / b << " " << (a * j) / b << "\n"
         << j << " " << (i * -1);
  return 0;
}
