#include <bits/stdc++.h>
using namespace std;
int a, b;
vector<pair<int, int> > ap, bp;
int main() {
  cin >> a >> b;
  for (int i = 1; i < a; i++) {
    int x;
    if (i >= a) break;
    x = (int)sqrt(a * a - i * i);
    if (x * x + i * i == a * a) {
      ap.push_back(pair<int, int>(x, i));
    }
  }
  for (int i = 1; i < b; i++) {
    int x;
    if (i >= b) break;
    x = (int)sqrt(b * b - i * i);
    if (x * x + i * i == b * b) {
      bp.push_back(pair<int, int>(x, i));
    }
  }
  for (int i = 0; i < ap.size(); i++) {
    for (int j = 0; j < bp.size(); j++) {
      if (ap[i].first == bp[j].first) continue;
      if (ap[i].first * bp[j].first == ap[i].second * bp[j].second) {
        cout << "YES" << endl;
        cout << "0 0" << endl;
        cout << -1 * ap[i].second << " " << -1 * ap[i].first << endl;
        cout << bp[j].second << " " << -1 * bp[j].first << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
}
