#include <bits/stdc++.h>
using namespace std;
const int OO = (int)2e9;
const double eps = 1e-6;
int main() {
  std::ios_base::sync_with_stdio(false);
  int a, b, i, j, a1, b1;
  cin >> a >> b;
  if (b < a) swap(a, b);
  for (i = 1; i <= a; i++) {
    a1 = round(sqrt(a * a - i * i));
    if (a1 * a1 + i * i == a * a) {
      for (j = 1; j <= b; j++) {
        b1 = round(sqrt(b * b - j * j));
        if (b1 * b1 + j * j == b * b) {
          if (fabs((double(a1) / i) * double(j) / -b1 + 1) <= eps) {
            cout << "YES" << endl;
            cout << 0 << " " << 0 << endl;
            cout << i << " " << a1 << endl;
            cout << b1 << " " << -j << endl;
            return 0;
          }
        }
      }
    }
  }
  for (i = 1; i <= b; i++) {
    a1 = round(sqrt(b * b - i * i));
    if (a1 * a1 + i * i == b * b) {
      for (j = 1; j <= a; j++) {
        b1 = round(sqrt(a * a - j * j));
        if (b1 * b1 + j * j == a * a) {
          if (fabs((double(a1) / i) * double(j) / -b1 + 1) <= eps) {
            cout << "YES" << endl;
            cout << 0 << " " << 0 << endl;
            cout << i << " " << a1 << endl;
            cout << -b1 << " " << j << endl;
            return 0;
          }
        }
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
