#include <bits/stdc++.h>
using namespace std;
using lli = long long;
using lld = long double;
using ulli = unsigned long long int;
using pll = pair<lli, lli>;
using ttt = pair<lli, pll>;
using vttt = vector<ttt>;
using vll = vector<pll>;
using vl = vector<lli>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using cd = complex<lld>;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void sanjeev(int kkkk) {
  int a, b;
  cin >> a >> b;
  for (int x = 1; x < a; x++) {
    double y = sqrt(double(a * a) - double(x * x));
    if (y == ceil(y)) {
      double g = gcd(int(x), int(y));
      double p = -(y / g);
      double q = (x / g);
      double B = sqrt(pow(p, 2) + pow(q, 2));
      if (b % int(B) != 0) {
        continue;
      }
      p *= (b / B);
      q *= (b / B);
      if (x - p == 0 || y - q == 0) continue;
      cout << "YES" << '\n';
      cout << "0"
           << " "
           << "0" << '\n';
      cout << int(x) << " " << int(y) << '\n';
      cout << int(p) << " " << int(q) << '\n';
      return;
    }
  }
  cout << "NO";
}
int main() {
  if (!0) ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(10);
  int t = 1;
  for (int i = 0; i < t; i++) {
    sanjeev(i + 1);
  }
  if (0) system("pause");
}
