#include <bits/stdc++.h>
using namespace std;
int rands() {
  static int x = 1364684679;
  x += (x << 2) + 1;
  return x;
}
struct point {
  double x, y;
  int init() { return scanf("%lf%lf", &x, &y); }
  point operator+(point a) {
    point ret;
    ret.x = x + a.x;
    ret.y = y + a.y;
    return ret;
  }
  point operator-(point a) {
    point ret;
    ret.x = x - a.x;
    ret.y = y - a.y;
    return ret;
  }
  double operator*(point a) { return x * a.y - y * a.x; }
  double operator^(point a) { return x * a.x + y * a.y; }
};
struct circle {
  point o;
  double r;
};
struct point3 {
  double x, y, z;
  int init() { return scanf("%lf%lf%lf", &x, &y, &z); }
  void output() { printf("%lf %lf %lf", x, y, z); }
  point3 operator+(point3 a) {
    point3 ret;
    ret.x = x + a.x;
    ret.y = y + a.y;
    ret.z = z + a.z;
    return ret;
  }
  point3 operator-(point3 a) {
    point3 ret;
    ret.x = x - a.x;
    ret.y = y - a.y;
    ret.z = z - a.z;
    return ret;
  }
  point3 operator*(point3 a) {
    point3 ret;
    ret.x = y * a.z - z * a.y;
    ret.y = z * a.x - x * a.z;
    ret.z = x * a.y - y * a.x;
    return ret;
  }
  point3 operator*(double b) {
    point3 ret;
    ret.x = x * b;
    ret.y = y * b;
    ret.z = z * b;
    return ret;
  }
  double operator^(point3 a) { return x * a.x + y * a.y + z * a.z; }
  double vlen() { return sqrt(x * x + y * y + z * z); }
};
double xmult(point p0, point p1, point p2) {
  return (p1.x - p0.x) * (p2.y - p0.y) - (p1.y - p0.y) * (p2.x - p0.x);
}
point3 xmult3(point3 p0, point3 p1, point3 p2) {
  point3 ret;
  ret.x = (p1.y - p0.y) * (p2.z - p0.z) - (p1.z - p0.z) * (p2.y - p0.y);
  ret.y = (p1.z - p0.z) * (p2.x - p0.x) - (p1.x - p0.x) * (p2.z - p0.z);
  ret.z = (p1.x - p0.x) * (p2.y - p0.y) - (p1.y - p0.y) * (p2.x - p0.x);
  return ret;
}
double dot(point a, point b) { return a.x * b.x + a.y * b.y; }
double dot3(point3 a, point3 b) { return a.x * b.x + a.y * b.y + a.z * b.z; }
double dist(point a, point b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
double dist3(point3 a, point3 b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y) +
              (a.z - b.z) * (a.z - b.z));
}
int fastget() {
  char c;
  int ans = 0;
  c = getchar();
  int sign = 1;
  while (!(c >= '0' && c <= '9' || c == '-')) c = getchar();
  if (c == '-') sign = -1, c = getchar();
  while (c >= '0' && c <= '9') {
    ans = (ans << 3) + (ans << 1) + c - '0';
    c = getchar();
  }
  return ans * sign;
}
void fastput(int x) {
  char s[12];
  int a = 0;
  if (x == 0)
    puts("0");
  else {
    if (x < 0) putchar('-'), x = -x;
    while (x) {
      s[a++] = x % 10 + '0';
      x /= 10;
    }
    for (a--; a >= 0; a--) putchar(s[a]);
    putchar('\n');
  }
}
int a, b;
int ax[4010], bx[4010], ay[4010], by[4010];
int lx, ly;
bool flag;
int is(int x) {
  int y = (int)sqrt(x) - 5 >= 0 ? (int)sqrt(x) - 5 : 0;
  while (y * y < x) ++y;
  if (y * y == x) return y;
  return 0;
}
bool check(int pa, int pb) {
  if (ax[pa] == 0) return 0;
  if (ay[pa] == 0) return 0;
  if (bx[pb] == 0) return 0;
  if (by[pb] == 0) return 0;
  int xx = ax[pa] - bx[pb];
  int yy = ay[pa] - by[pb];
  if (xx == 0 || yy == 0) return 0;
  if (xx * xx + yy * yy == a * a + b * b) {
    printf("YES\n0 0\n");
    printf("%d %d\n%d %d\n", ax[pa], ay[pa], bx[pb], by[pb]);
    return 1;
  }
  return 0;
}
int main() {
  flag = 0;
  a = fastget();
  b = fastget();
  lx = ly = 0;
  int xxx;
  for (int i = 1; i <= a; ++i)
    if (a * a - i * i > 0)
      if (xxx = is(a * a - i * i)) {
        ax[lx] = i;
        ay[lx] = xxx;
        ++lx;
      }
  for (int i = 1; i <= b; ++i)
    if (b * b - i * i > 0)
      if (xxx = is(b * b - i * i)) {
        bx[ly] = -i;
        by[ly] = xxx;
        ++ly;
      }
  for (int i = 0; i < lx && !flag; ++i)
    for (int j = 0; j < ly && !flag; ++j)
      if (check(i, j)) flag = 1;
  if (!flag) printf("NO\n");
  return 0;
}
