#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > GetPoints(int len, bool t) {
  vector<pair<int, int> > ans;
  if (t) {
    for (int i = 0; i <= 1000; i++)
      for (int j = 0; j <= 1000; j++) {
        if (i == 0 || j == 0) continue;
        int c = i * i + j * j;
        int h = sqrt(c);
        if (h * h == c && h == len) ans.push_back(make_pair(i, j));
      }
  } else {
    for (int i = 0; i <= 1000; i++)
      for (int j = 0; j <= 1000; j++) {
        if (i == 0 || j == 0) continue;
        int c = i * i + j * j;
        int h = sqrt(c);
        if (h * h == c && h == len) ans.push_back(make_pair(-1 * i, j));
      }
  }
  return ans;
}
int main() {
  int a, b, c;
  cin >> a >> b;
  c = ((a * a) + (b * b));
  vector<pair<int, int> > A = GetPoints(a, 1);
  vector<pair<int, int> > B = GetPoints(b, 0);
  for (int i = 0; i < A.size(); i++) {
    pair<int, int> F = A[i];
    for (int j = 0; j < B.size(); j++) {
      pair<int, int> S = B[j];
      if (F.second != S.second) {
        int dx = abs(F.first - S.first);
        int dy = abs(F.second - S.second);
        int C = (dx * dx) + (dy * dy);
        if (C == c) {
          cout << "YES\n";
          cout << 0 << " " << 0 << endl;
          cout << F.first << " " << F.second << endl;
          cout << S.first << " " << S.second << endl;
          return 0;
        }
      }
    }
  }
  cout << "NO";
  return 0;
}
