#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, i, j, k, l, m, n, x, y;
  cin >> a >> b;
  for (x = 1; x < a; x++) {
    y = sqrt((a * a) - (x * x));
    if (y * y == ((a * a) - (x * x))) {
      if ((b * y) % a == 0 && (b * x) % a == 0) {
        if (y == (b * x) / a) continue;
        puts("YES");
        cout << 0 << " " << 0 << endl;
        cout << x << " " << y << endl;
        cout << -((b * y) / a) << " " << (b * x) / a << endl;
        return 0;
      }
    }
  }
  puts("NO");
  return 0;
}
