#include <bits/stdc++.h>
using namespace std;
const int DEBUG = 0;
namespace defs {
template <class Type>
Type read() {
  Type aa;
  int bb = 1, ch;
  while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-')
    ;
  ch == '-' ? aa = 0, bb = -1 : aa = ch - '0';
  while (ch = getchar(), ch >= '0' && ch <= '9') aa = aa * 10 + ch - '0';
  return bb == 1 ? aa : -aa;
}
const unsigned int rand_x = 11309;
const unsigned int rand_y = 1000000019;
unsigned int rand_cur;
unsigned int rand_int() { return rand_cur = rand_cur * rand_x + rand_y; }
const int inf = 1071026353;
const int mod = 1000000007;
const int modx = 998244353;
}  // namespace defs
namespace lightningwork {
int (*read)() = defs::read<int>;
bool get(int len, int &x, int &y) {
  len = len * len;
  for (int i = 1; i * i < len; ++i) {
    int j = sqrt(len - i * i) - 1;
    while (j * j + i * i < len) ++j;
    if (j * j + i * i == len) {
      x = i, y = j;
      return 1;
    }
  }
  return 0;
}
void work() {
  int x1, x2, y1, y2;
  int la = read();
  int lb = read();
  for (int i = 1; i < la; ++i) {
    x1 = i;
    y1 = sqrt(la * la - x1 * x1) - 1;
    while (y1 * y1 + x1 * x1 < la * la) ++y1;
    if (y1 * y1 + x1 * x1 > la * la) continue;
    y2 = (-x1) * (1.0 * lb / la);
    x2 = sqrt(lb * lb - y2 * y2) - 1;
    while (x2 * x2 + y2 * y2 < lb * lb) ++x2;
    if (x2 * x2 + y2 * y2 > lb * lb) continue;
    if (x1 * x2 + y1 * y2 != 0) continue;
    if (x1 == x2 || y1 == y2) continue;
    puts("YES");
    printf("%d %d\n", 0, 0);
    printf("%d %d\n", x1, y1);
    printf("%d %d\n", x2, y2);
    return;
  }
  puts("NO");
}
}  // namespace lightningwork
int main() {
  if (0)
    freopen(
        "work"
        ".in",
        "r", stdin),
        freopen(
            "work"
            ".out",
            "w", stdout);
  lightningwork::work();
  if (0) fclose(stdin), fclose(stdout);
  return 0;
}
