#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000;
int ___x1[maxn], ___y1[maxn], n1;
int ___x2[maxn], ___y2[maxn], n2;
int main(void) {
  int a, b;
  scanf("%d%d", &a, &b);
  for (int x = 1; x < a; ++x) {
    for (int y = 1; y < a; ++y) {
      if (x * x + y * y == a * a) {
        for (int dx = -1; dx <= 1; dx += 2) {
          for (int dy = -1; dy <= 1; dy += 2) {
            ___x1[n1] = dx * x;
            ___y1[n1] = dy * y;
            ++n1;
          }
        }
      }
    }
  }
  for (int x = 1; x < b; ++x) {
    for (int y = 1; y < b; ++y) {
      if (x * x + y * y == b * b) {
        for (int dx = -1; dx <= 1; dx += 2) {
          for (int dy = -1; dy <= 1; dy += 2) {
            ___x2[n2] = dx * x;
            ___y2[n2] = dy * y;
            ++n2;
          }
        }
      }
    }
  }
  for (int i = 0; i < n1; ++i) {
    for (int j = 0; j < n2; ++j) {
      if (___x1[i] * ___x2[j] + ___y1[i] * ___y2[j] == 0) {
        if (___x1[i] == ___x2[j] || ___y1[i] == ___y2[j]) {
          continue;
        }
        puts("YES");
        puts("0 0");
        printf("%d %d\n", ___x1[i], ___y1[i]);
        printf("%d %d\n", ___x2[j], ___y2[j]);
        return 0;
      }
    }
  }
  puts("NO");
  return 0;
}
