#include <bits/stdc++.h>
using namespace std;
vector<int> x[2], y[2];
int main() {
  int a, b, i, j;
  cin >> a >> b;
  for (i = 1; i <= 1000; i++) {
    for (j = 1; j <= 1000; j++) {
      if (i * i + j * j == a * a) {
        x[0].push_back(i);
        y[0].push_back(j);
      }
      if (i * i + j * j == b * b) {
        x[1].push_back(i);
        y[1].push_back(j);
      }
    }
  }
  for (i = 0; i < x[0].size(); i++) {
    for (j = 0; j < x[1].size(); j++) {
      if (x[0][i] * x[1][j] == y[0][i] * y[1][j]) {
        if (y[0][i] == y[1][j]) continue;
        printf("YES\n");
        printf("0 0\n");
        printf("%d %d\n", x[0][i], y[0][i]);
        printf("%d %d\n", -x[1][j], y[1][j]);
        return 0;
      }
    }
  }
  printf("NO\n");
  return 0;
}
