#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v1;
vector<pair<int, int> > v2;
int main() {
  int x, y;
  int a, b, c, d;
  cin >> x >> y;
  for (int i = 1; i <= x; ++i) {
    for (int j = i + 1; j <= x; ++j) {
      if (i * i + j * j == x * x) {
        a = i;
        b = j;
        v1.push_back(make_pair(a, b));
      }
    }
  }
  for (int i = 1; i <= y; ++i) {
    for (int j = i + 1; j <= y; ++j) {
      if (i * i + j * j == y * y) {
        c = i;
        d = j;
        v2.push_back(make_pair(c, d));
      }
    }
  }
  if (v1.size() == 0 || v2.size() == 0) {
    printf("NO\n");
  } else {
    int s1 = v1.size();
    int s2 = v2.size();
    bool flag = false;
    for (int i = 0; i < s1; ++i) {
      for (int j = 0; j < s2; ++j) {
        a = v1[i].first;
        b = v1[i].second;
        c = v2[j].first;
        d = v2[j].second;
        if (a * d == b * c) {
          if (d == a) {
            swap(a, b);
            swap(c, d);
          }
          printf("YES\n");
          printf("%d %d\n", 0, a);
          printf("%d %d\n", b, 0);
          printf("%d %d\n", b + c, d);
          flag = true;
        }
        if (flag) break;
      }
      if (flag) break;
    }
    if (!flag) printf("NO\n");
  }
  return 0;
}
