#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000000 + 7;
const long long int N = 10000000 + 6;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int a, b;
  cin >> a >> b;
  vector<pair<int, int> > bb, aa;
  for (int i = 1; i < 1000; i++) {
    for (int j = 1; j < 1000; j++) {
      if (i * i + j * j == a * a) aa.push_back(make_pair(i, j));
      if (i * i + j * j == b * b) bb.push_back(make_pair(i, j));
    }
  }
  bool flag = false;
  for (int i = 0; i < aa.size(); i++) {
    for (int j = 0; j < bb.size(); j++) {
      int p = aa[i].first;
      int q = aa[i].second;
      int r = bb[j].first;
      int s = bb[j].second;
      if (p * s == q * r) {
        if (p != s) {
          cout << "YES\n"
               << "0 0\n"
               << p << " " << q << '\n'
               << s << " " << -r;
          flag = true;
          break;
        }
      }
    }
    if (flag == true) break;
  }
  if (flag == false) cout << "NO\n" << endl;
  return 0;
}
