#include <bits/stdc++.h>
using namespace std;
set<int> fullsq;
int main() {
  int a, b;
  cin >> a >> b;
  for (int(i) = (1); i < (1000); ++(i)) fullsq.insert(i * i);
  for (int(a1) = (-a + 1); a1 < (a); ++(a1))
    if (a1 != 0) {
      int b1 = a * a - a1 * a1;
      if (fullsq.find(b1) != fullsq.end())
        b1 = int(pow(b1 + 1, 0.5));
      else
        continue;
      for (int(a2) = (-b + 1); a2 < (b); ++(a2))
        if (a2 != 0 && a1 != a2) {
          int b2 = b * b - a2 * a2;
          if (fullsq.find(b2) != fullsq.end())
            b2 = int(pow(b2 + 1, 0.5));
          else
            continue;
          if ((a1 - a2) * (a1 - a2) + (b1 - b2) * (b1 - b2) == a * a + b * b &&
              b1 != b2) {
            cout << "YES\n0 0\n";
            cout << a1 << " " << b1 << "\n";
            cout << a2 << " " << b2 << "\n";
            return 0;
          }
          b2 = -b2;
          if ((a1 - a2) * (a1 - a2) + (b1 - b2) * (b1 - b2) == a * a + b * b &&
              b1 != b2) {
            cout << "YES\n0 0\n";
            cout << a1 << " " << b1 << "\n";
            cout << a2 << " " << b2 << "\n";
            return 0;
          }
        }
    }
  cout << "NO";
  return 0;
}
