#include <bits/stdc++.h>
using namespace std;
int dx[] = {-1, -1, 1, 1}, dy[] = {-1, 1, -1, 1};
vector<pair<int, int> > solve(int n) {
  vector<pair<int, int> > ans;
  for (int i = 1; i < n + 1; i++)
    for (int j = 1; j < n + 1; j++)
      if (i * i + j * j == n * n) ans.push_back(make_pair(i, j));
  return ans;
}
bool right(int x1, int y1, int x2, int y2) {
  if (x1 == x2 || y1 == y2) return 0;
  return (x1 * x2 + y1 * y2 == 0);
}
int main() {
  int a, b;
  cin >> a >> b;
  vector<pair<int, int> > A = solve(a), B = solve(b);
  for (int i = 0; i < A.size(); i++)
    for (int j = 0; j < B.size(); j++)
      for (int k = 0; k < 4; k++)
        if (right(A[i].first, A[i].second, dx[k] * B[j].first,
                  dy[k] * B[j].second)) {
          cout << "YES\n0 0\n"
               << A[i].first << ' ' << A[i].second << '\n'
               << dx[k] * B[j].first << ' ' << dy[k] * B[j].second << '\n';
          return 0;
        }
  cout << "NO\n";
  return 0;
}
