#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > vec1, vec2;
long long a, b;
void init() {
  for (int i = 1; i <= a; i++)
    for (int j = 1; j <= a; j++)
      if (i * i + j * j == a * a) vec1.push_back(make_pair(-i, -j));
  for (int i = 1; i <= b; i++)
    for (int j = 1; j <= b; j++)
      if (i * i + j * j == b * b) vec2.push_back(make_pair(-i, j));
}
int main() {
  cin >> a >> b;
  init();
  for (int i = 0; i < (int)vec1.size(); i++) {
    for (int j = 0; j < (int)vec2.size(); j++) {
      long long dx = vec2[j].first - vec1[i].first;
      long long dy = vec2[j].second - vec1[i].second;
      if (dx * dx + dy * dy != a * a + b * b || dx == 0) continue;
      cout << "YES" << endl;
      cout << 0 << " " << 0 << endl;
      cout << vec1[i].first << " " << vec1[i].second << endl;
      cout << vec2[j].first << " " << vec2[j].second << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
