#include <bits/stdc++.h>
using namespace std;
bool isInt(double ans) {
  if ((double)((int)ans) == ans) return true;
  return false;
}
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  bool ok = false;
  int rx1 = 0, ry1 = 0, rx2 = 0, ry2 = 0;
  for (int x1 = -a; x1 <= a; x1++) {
    for (int x2 = -b; x2 <= b; x2++) {
      double res1 = sqrt(a * a - x1 * x1);
      double res2 = sqrt(b * b - x2 * x2);
      if (isInt(res1) && isInt(res2)) {
        int y1 = (int)res1, y2 = (int)res2;
        if (x1 == 0 || y1 == 0 || x2 == 0 || y2 == 0 || x1 == x2 || y1 == y2)
          continue;
        int dotProd = x1 * x2 + y1 * y2;
        if (dotProd == 0) {
          ok = true;
          rx1 = x1;
          ry1 = y1;
          rx2 = x2;
          ry2 = y2;
        }
      }
    }
  }
  if (ok) {
    printf("YES\n");
    printf("%d %d\n", 0, 0);
    printf("%d %d\n", rx1, ry1);
    printf("%d %d\n", rx2, ry2);
  } else {
    printf("NO\n");
  }
  return 0;
}
