#include <bits/stdc++.h>
using namespace std;
int a, b, d[2000000];
vector<pair<int, int> > res, c[2000000];
void is_right(int x1, int y1, int x2, int y2) {
  if (res.size()) return;
  double m1 = y1 / (x1 * 1.0), m2 = -1 * y2 / (x2 * 1.0);
  if (y2 - y1 && (fabs(m1 + 1 / m2) < 0.001)) {
    res.push_back(pair<int, int>(x1, y1));
    res.push_back(pair<int, int>(-1 * x2, y2));
  }
  return;
}
int main() {
  for (int i = 1; i < 1000; i++)
    for (int j = 1; j < 1000; j++) {
      int indx = i * i + j * j;
      d[indx] = 1;
      c[indx].push_back(pair<int, int>(i, j));
    }
  cin >> a >> b;
  if (d[a * a] && d[b * b]) {
    int x = a * a, y = b * b;
    for (int i = 0; i < c[x].size(); i++) {
      for (int j = 0; j < c[y].size(); j++) {
        is_right(c[x][i].first, c[x][i].second, c[y][j].first, c[y][j].second);
        is_right(c[x][i].second, c[x][i].first, c[y][j].first, c[y][j].second);
        is_right(c[x][i].first, c[x][i].second, c[y][j].second, c[y][j].first);
        is_right(c[x][i].second, c[x][i].first, c[y][j].second, c[y][j].first);
      }
    }
  }
  if (!res.size())
    cout << "NO\n";
  else {
    cout << "YES\n0 0\n";
    cout << res[0].first << " " << res[0].second << endl;
    cout << res[1].first << " " << res[1].second << endl;
  }
}
