#include <bits/stdc++.h>
using namespace std;
int a, b;
int main() {
  scanf("%d %d", &a, &b);
  if (a > b) swap(a, b);
  for (int i = -a; i <= a; ++i)
    for (int j = -a; j <= a; ++j)
      if (i * i + j * j == a * a) {
        int x = -j;
        int y = i;
        if ((x * b) % a == 0 && (y * b) % a == 0) {
          int px = (x * b) / a;
          int py = (y * b) / a;
          if (px != 0 && py != 0) {
            printf("YES\n");
            printf("0 0\n");
            printf("%d %d\n", i, j);
            printf("%d %d", px, py);
            return 0;
          }
        }
      }
  printf("NO");
  return 0;
}
