#include <bits/stdc++.h>
using namespace std;
struct T1 {
  int s1, s2;
};
struct T2 {
  int l1, l2;
};
int main() {
  int a, b;
  while (scanf("%d %d", &a, &b) != EOF) {
    vector<T1> avec;
    vector<T2> bvec;
    for (int i = 1; i < a; ++i)
      for (int j = 1; j < a; ++j)
        if (i * i + j * j == a * a) avec.push_back((T1){i, j});
    for (int i = 1; i < b; ++i)
      for (int j = 1; j < b; ++j)
        if (i * i + j * j == b * b) bvec.push_back((T2){i, j});
    bool ok = 0;
    int s1, s2, l1, l2;
    for (int i = 0; i < avec.size(); ++i)
      for (int j = 0; j < bvec.size(); ++j)
        if (avec[i].s1 * bvec[j].l1 == avec[i].s2 * bvec[j].l2 &&
            avec[i].s2 != bvec[j].l2) {
          ok = 1;
          s1 = avec[i].s1, s2 = avec[i].s2;
          l1 = bvec[j].l1, l2 = bvec[j].l2;
          break;
        }
    if (ok)
      printf("YES\n0 0\n%d %d\n%d %d\n", -s1, s2, l1, l2);
    else
      printf("NO\n");
  }
  return 0;
}
