#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  for (int x = 1; x < a; x++) {
    double y = sqrt(a * a - x * x);
    if (y - (int)y != 0) continue;
    double xt, yt;
    xt = -1 * (b * y) / a;
    yt = (b * x) / a;
    if (xt == (int)xt && yt == (int)yt && y != yt && x != xt) {
      cout << "YES" << endl;
      cout << "0 0 " << endl;
      cout << x << " " << y << endl;
      cout << xt << " " << yt;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
