#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int nmax = 100005;
const long long inf = 1e9;
const double eps = 1e-6;
const long long pw = 31;
vector<pair<int, int> > p;
vector<pair<int, int> > pp;
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  if (a > b) swap(a, b);
  for (int i = -2000; i <= 2000; ++i) {
    for (int j = -2000; j <= 2000; ++j) {
      if (i && j) {
        if (i * i + j * j == a * a) p.push_back({i, j});
        if (i * i + j * j == a * a + b * b) pp.push_back({i, j});
      }
    }
  }
  for (int i = 0; i < p.size(); ++i) {
    for (int j = 0; j < pp.size(); ++j) {
      pair<int, int> c = p[i];
      pair<int, int> cc = pp[j];
      if (-c.first * (cc.first - c.first) - c.second * (cc.second - c.second) ==
          0) {
        printf("YES\n");
        printf("0 0\n");
        printf("%d %d\n", c.first, c.second);
        printf("%d %d\n", cc.first, cc.second);
        return 0;
      }
    }
  }
  printf("NO\n");
  return 0;
}
