#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > v1, v2;
long long D(long long x) { return (x * x); }
void P(long long a, long long n, int k) {
  long long i, j;
  for (i = 1; i <= a; i++) {
    for (j = 1; j <= a; j++) {
      if (i * i + j * j == n * n) {
        if (k == 1) {
          v1.push_back(make_pair(i * -1, j * -1));
        } else {
          v2.push_back(make_pair(i, j * -1));
        }
      }
    }
  }
}
int main() {
  long long a, b, c, x, y, i, j;
  x = y = 0;
  v1.clear();
  v2.clear();
  cin >> a >> b;
  if (a > b) swap(a, b);
  c = b + 1;
  if ((a + b > c) and (b + c > a) and (c + a > b)) {
    int flag;
    P(a, a, 1);
    P(b, b, 2);
    for (i = 0; i < v1.size(); i++) {
      for (j = 0; j < v2.size(); j++) {
        if (v1[i].second == v2[j].second or
            D(v1[i].first - v2[j].first) + D(v1[i].second - v2[j].second) !=
                D(a) + D(b))
          continue;
        cout << "YES\n";
        cout << v1[i].first << " " << v1[i].second << '\n';
        cout << v2[j].first << " " << v2[j].second << '\n';
        cout << 0 << " " << 0 << '\n';
        return 0;
      }
    }
    cout << "NO\n";
  } else
    cout << "NO\n";
  return 0;
}
