#include <bits/stdc++.h>
using namespace std;
int a, b;
int dist(int x, int y, int xx, int yy) {
  return (y - yy) * (y - yy) + (x - xx) * (x - xx);
}
vector<int> x, y, xx, yy;
int main() {
  int i, j, k, cnt, flag;
  while (~scanf("%d%d", &a, &b)) {
    flag = 0;
    x.clear();
    y.clear();
    xx.clear();
    yy.clear();
    int ok = 1;
    for (i = 1; i < a; i++) {
      for (j = 1; j < a; j++) {
        if (i * i + j * j == a * a) {
          ok = 0;
          x.push_back(i);
          y.push_back(j);
        }
      }
    }
    if (ok) flag = 1;
    for (i = 1; i < b; i++) {
      for (j = 1; j < b; j++) {
        if (i * i + j * j == b * b) {
          ok = 0;
          xx.push_back(i);
          yy.push_back(j);
        }
      }
    }
    int x1, y1, x2, y2;
    if (ok) flag = 1;
    if (flag)
      puts("NO");
    else {
      flag = 1;
      for (i = 0; i < x.size() && flag; i++) {
        for (j = 0; j < xx.size(); j++) {
          if (y[i] != xx[j]) {
            if (dist(0, 0, -x[i], y[i]) + dist(0, 0, yy[j], xx[j]) ==
                dist(yy[j], xx[j], -x[i], y[i])) {
              flag = 0;
              printf("YES\n%d %d\n%d %d\n%d %d\n", 0, 0, -x[i], y[i], yy[j],
                     xx[j]);
              break;
            }
          } else if (x[i] != xx[j]) {
            if (dist(0, 0, -y[i], x[i]) + dist(0, 0, yy[j], xx[j]) ==
                dist(yy[j], xx[j], -y[i], x[i])) {
              flag = 0;
              printf("YES\n%d %d\n%d %d\n%d %d\n", 0, 0, -y[i], x[i], yy[j],
                     xx[j]);
              break;
            }
          }
        }
      }
      if (flag) puts("NO");
    }
  }
  return 0;
}
