#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(false);
  long long a, b;
  vector<pair<long long, long long> > va, vb;
  cin >> a >> b;
  for (long long x = -a + 1; x < a; x++) {
    for (long long y = -a + 1; y < a; y++) {
      if (x * x + y * y == a * a) va.push_back(make_pair(x, y));
    }
  }
  for (long long x = -b + 1; x < b; x++) {
    for (long long y = -b + 1; y < b; y++) {
      if (x * x + y * y == b * b) vb.push_back(make_pair(x, y));
    }
  }
  for (int i = 0; i < (int)va.size(); i++) {
    for (int j = 0; j < (int)vb.size(); j++) {
      if (va[i].first * vb[j].first + va[i].second * vb[j].second == 0 &&
          va[i].first != vb[j].first && va[i].second != vb[j].second) {
        cout << "YES\n"
             << 0 << ' ' << 0 << "\n"
             << va[i].first << ' ' << va[i].second << "\n"
             << vb[j].first << ' ' << vb[j].second << "\n";
        exit(0);
      }
    }
  }
  cout << "NO\n";
  return 0;
}
