#include <bits/stdc++.h>
using namespace std;
int a, b;
const double eps = 1e-8;
int gcd(int first, int second) {
  if (first == 0) return second;
  return gcd(second % first, first);
}
void check(int first, int second) {
  pair<int, int> k = make_pair(second, -first);
  int g = gcd(k.first, k.second);
  k.first /= g;
  k.second /= g;
  double xd2 = cos(atan2(double(k.second), double(k.first))) * double(b);
  int x2 = round(xd2);
  if (fabs(xd2 - x2) > eps) return;
  int y2 = round(double(k.second) * x2 / k.first);
  if (fabs(double(k.second) * x2 / k.first - y2) > eps) return;
  if (x2 * x2 + y2 * y2 == b * b && x2 != 0 && y2 != 0) {
    if ((k.first % x2 == 0 || x2 % k.first == 0) &&
        (k.second % y2 == 0 || y2 % k.second == 0) && second != y2) {
      cout << "YES\n";
      cout << "0 0\n";
      cout << first << ' ' << second << endl;
      cout << x2 << ' ' << y2 << endl;
      exit(0);
    }
  }
}
int main() {
  cin >> a >> b;
  int sqa = a * a;
  for (int i = 1; i < sqa; i++) {
    int first = sqrt(i);
    int second = sqrt(abs(sqa - i));
    if (first * first == i && second * second == abs(sqa - i))
      check(-first, second);
  }
  cout << "NO\n";
  return 0;
}
