#include <bits/stdc++.h>
const int MAXN = 30;
struct Node {
  int x, y;
};
Node edgeA[MAXN], edgeB[MAXN];
void getCanEdge(Node edge[], int &len, int x) {
  int y = (int)sqrt((x * x) >> 1);
  for (int i = 1; i <= y; ++i) {
    int temp = x * x - i * i;
    double temp2 = sqrt(temp);
    if (ceil(temp2) == temp2) {
      edge[len].x = i;
      edge[len].y = (int)temp2;
      ++len;
    }
  }
}
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  int lenA = 0;
  getCanEdge(edgeA, lenA, a);
  int lenB = 0;
  getCanEdge(edgeB, lenB, b);
  bool flag = false;
  for (int i = 0; i < lenA && !flag; ++i) {
    for (int j = 0; j < lenB && !flag; ++j) {
      if (a * edgeB[j].x == b * edgeA[i].x &&
          a * edgeB[j].y == b * edgeA[i].y) {
        if (edgeA[i].y == edgeB[j].x) {
          printf("YES\n0 0\n%d %d\n%d %d\n", -edgeA[i].y, edgeA[i].x,
                 edgeB[j].x, edgeB[j].y);
        } else {
          printf("YES\n0 0\n%d %d\n%d %d\n", -edgeA[i].x, edgeA[i].y,
                 edgeB[j].y, edgeB[j].x);
        }
        flag = true;
      }
    }
  }
  if (!flag) {
    printf("NO\n");
  }
  return 0;
}
