#include <bits/stdc++.h>
using namespace std;
int a, b;
int main() {
  int x = 0, y = 0;
  scanf("%d%d", &a, &b);
  bool OK = true;
  for (int i = 1; i < a; i++) {
    x = i;
    y = sqrt(a * a - i * i);
    if (y * y == a * a - i * i) {
      OK = false;
      if (OK || x == 0 || y == 0) continue;
      if ((b * x) % a != 0 || (b * y) % a != 0) continue;
      if (b * x / a != y) {
        printf("YES\n");
        printf("0 0\n");
        printf("%d %d\n", x, y);
        printf("%d %d\n", -b * y / a, b * x / a);
        return 0;
      }
      if (b * y / a != x) {
        printf("YES\n");
        printf("0 0\n");
        printf("%d %d \n", x, y);
        printf("%d %d\n", b * y / a, -b * x / a);
        return 0;
      }
    }
  }
  printf("NO\n");
  return 0;
}
