#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, p, q, x, y;
  cin >> a >> b;
  for (p = 1; p * p < a * a; ++p)
    for (q = 1; q < p && p * p + q * q <= a * a; ++q) {
      if (p * p + q * q == a * a) {
        if ((b * q) % a == 0 && (p * b) % a == 0) {
          y = (-p * b) / a;
          x = (b * q) / a;
          if (p != x && q != y) {
            puts("YES\n0 0");
            cout << p << " " << q << endl;
            cout << x << " " << y << endl;
            return 0;
          }
          x = -x;
          y = -y;
          if (p != x && q != y) {
            puts("YES\n0 0");
            cout << p << " " << q << endl;
            cout << x << " " << y << endl;
            return 0;
          }
        }
      }
    }
  puts("NO");
}
