#include <bits/stdc++.h>
using namespace std;
bool f[1005];
vector<int> x[1005];
vector<int> y[1005];
int dx[4] = {1, 1, -1, -1};
int dy[4] = {1, -1, 1, -1};
int main() {
  for (int i = 1; i <= 1000; i++) {
    for (int j = 1; j <= 1000; j++) {
      int p = i * i + j * j;
      int u = (int)(sqrt(p));
      if (u * u == p && u <= 1000) {
        f[u] = 1;
        x[u].push_back(i);
        y[u].push_back(j);
      }
    }
  }
  int a, b;
  scanf("%d%d", &a, &b);
  if (f[a] && f[b]) {
    for (int r = 0; r < x[a].size(); r++)
      for (int s = 0; s < x[b].size(); s++) {
        int u = x[a][r], v = y[a][r];
        for (int i = 0; i < 4; i++) {
          int p = u * dx[i];
          int q = v * dy[i];
          if (x[b][s] * p + y[b][s] * q == 0 &&
              (x[b][s] != p && y[b][s] != q)) {
            printf("YES\n");
            printf("0 0\n");
            printf("%d %d\n", x[b][s], y[b][s]);
            printf("%d %d\n", p, q);
            return 0;
          }
        }
        swap(u, v);
        for (int i = 0; i < 4; i++) {
          int p = u * dx[i];
          int q = v * dy[i];
          if (x[b][s] * p + y[b][s] * q == 0 &&
              (x[b][s] != p && y[b][s] != q)) {
            printf("YES\n");
            printf("0 0\n");
            printf("%d %d\n", x[b][s], y[b][s]);
            printf("%d %d\n", p, q);
            return 0;
          }
        }
      }
    printf("NO\n");
  } else
    printf("NO\n");
  return 0;
}
