#include <bits/stdc++.h>
using namespace std;
double cal_dis(int i, int j) { return sqrt(i * i + j * j); }
int main() {
  int a, b;
  while (~scanf("%d %d", &a, &b)) {
    int ansA[1000][2];
    int ansB[1000][2];
    int cntA = 0, cntB = 0;
    int flagA = 0, flagB = 0;
    for (int i = -a; i <= a; i++) {
      for (int j = -a; j <= a; j++) {
        if (cal_dis(i, j) == a && i != 0 && j != 0) {
          ansA[cntA][0] = i;
          ansA[cntA++][1] = j;
          flagA = 1;
        }
      }
    }
    for (int i = -b; i <= b; i++) {
      for (int j = -b; j <= b; j++) {
        if (cal_dis(i, j) == b && i != 0 && j != 0) {
          ansB[cntB][0] = i;
          ansB[cntB++][1] = j;
          flagB = 1;
        }
      }
    }
    if (!flagA || !flagB)
      printf("NO\n");
    else {
      int i, j;
      int flag = 0;
      for (i = 0; i < cntA; i++) {
        for (j = 0; j < cntB; j++) {
          int w = ansA[i][0] - ansB[j][0];
          int k = ansA[i][1] - ansB[j][1];
          if (a * a + b * b == w * w + k * k && w != 0 && k != 0) {
            printf("YES\n");
            printf("0 0\n");
            printf("%d %d\n", ansA[i][0], ansA[i][1]);
            printf("%d %d\n", ansB[j][0], ansB[j][1]);
            flag = 1;
            break;
          }
        }
        if (flag) break;
      }
      if (!flag) printf("NO\n");
    }
  }
  return 0;
}
