#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int a, b;
  cin >> a >> b;
  long double cya, cyb, cxb;
  for (int i = a - 1; i >= 1; i--) {
    cya = sqrt(pow(a, 2) - pow(i, 2));
    if (fabs(cya - round(cya)) > 0.00000001) {
      continue;
    }
    cya = round(cya);
    if (pow(cya, 2) + pow(i, 2) == pow(a, 2)) {
      long double k = tan(((2 * acos(0)) / 2.0) +
                          atan((long double)(cya) / (long double)(i)));
      cxb = -sqrt(pow(b, 2.0) / (1.0 + pow(k, 2.0)));
      if (fabs(cxb - round(cxb)) > 0.00000001) {
        continue;
      } else {
        cxb = round(cxb);
      }
      cyb = k * cxb;
      if (fabs(cyb - round(cyb)) > 0.00000001) {
        continue;
      } else {
        cyb = round(cyb);
      }
      if ((cyb <= 0) || (cyb >= b)) {
        break;
      }
      if (pow(cxb, 2) + pow(cyb, 2) != pow(b, 2)) {
        continue;
      } else if (cya != cyb) {
        cout << "YES" << endl;
        cout << 0 << " " << 0 << endl;
        cout << (int)(i) << " " << (round)(cya) << endl;
        cout << (round)(cxb) << " " << (round)(cyb) << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
}
