#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;
const double EPS = (1e-7);
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = res * x;
    y = y >> 1;
    x = x * x;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long a, b;
  cin >> a >> b;
  long long sqa = a * a;
  long long sqb = b * b;
  vector<pair<int, int>> aa;
  vector<pair<int, int>> bb;
  for (long long i = 1; i < a; i++) {
    long long x = sqrt(sqa - i * i);
    if (dcmp(sqrt(sqa - i * i), x) == 0) {
      aa.push_back({i, x});
    }
  }
  for (long long i = 1; i < b; i++) {
    long long x = sqrt(sqb - i * i);
    if (dcmp(sqrt(sqb - i * i), x) == 0) {
      bb.push_back({-x, i});
    }
  }
  if (aa.size() == 0 || bb.size() == 0) {
    cout << "NO" << endl;
    return 0;
  }
  for (int i = 0; i < aa.size(); i++) {
    for (int j = 0; j < bb.size(); j++) {
      long long check =
          (aa[i].first * bb[j].first) / (aa[i].second * bb[j].second);
      if ((aa[i].second * bb[j].second) != 0 &&
          (aa[i].first * bb[j].first) % (aa[i].second * bb[j].second) == 0 &&
          check == -1) {
        if (aa[i].first - bb[j].first != 0 &&
            aa[i].second - bb[j].second != 0) {
          cout << "YES" << endl;
          cout << "0 0" << endl;
          cout << aa[i].first << " " << aa[i].second << endl;
          cout << bb[j].first << " " << bb[j].second << endl;
          return 0;
        }
        if (aa[i].second - bb[j].second == 0) {
          cout << "YES" << endl;
          cout << "0 0" << endl;
          cout << aa[i].second << " " << aa[i].first << endl;
          cout << -bb[j].second << " " << -bb[j].first << endl;
          return 0;
        }
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
