#include <bits/stdc++.h>
using namespace std;
int gcd(int u, int v) {
  int tmp;
  while (v) {
    tmp = v;
    v = u % v;
    u = tmp;
  }
  return u;
}
int main() {
  int a, b, t;
  cin >> a >> b;
  if (a > b) {
    swap(a, b);
  }
  if ((t = gcd(a, b)) == 1) {
    cout << "NO" << endl;
    return 0;
  }
  int flag = 1;
  for (int i = 1; i <= t; i++) {
    for (int j = i; j <= t; j++) {
      if (t * t == i * i + j * j) {
        flag = 0;
        cout << "YES" << endl;
        cout << "0 0" << endl;
        cout << i * a / t << " " << -j * a / t << endl;
        cout << j * b / t << " " << i * b / t << endl;
        return 0;
      }
    }
  }
  if (flag) cout << "NO" << endl;
  return 0;
}
