#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long int> issq(1000001, 0);
  for (long long int i = 1; i <= 1000; i++) issq[i * i]++;
  long long int a, b, flag = 0;
  cin >> a >> b;
  vector<pair<long long int, long long int>> lista, listb;
  for (long long int i = 1; i * i < a * a; i++) {
    if (issq[a * a - i * i]) {
      lista.push_back(make_pair(i, sqrt(a * a - i * i)));
      lista.push_back(make_pair(-i, sqrt(a * a - i * i)));
      lista.push_back(make_pair(i, -sqrt(a * a - i * i)));
      lista.push_back(make_pair(-i, -sqrt(a * a - i * i)));
    }
  }
  for (long long int i = 1; i * i < b * b; i++) {
    if (issq[b * b - i * i]) {
      listb.push_back(make_pair(i, sqrt(b * b - i * i)));
      listb.push_back(make_pair(-i, sqrt(b * b - i * i)));
      listb.push_back(make_pair(i, -sqrt(b * b - i * i)));
      listb.push_back(make_pair(-i, -sqrt(b * b - i * i)));
    }
  }
  for (long long int i = 0; i < lista.size(); i++) {
    for (long long int j = 0; j < listb.size(); j++) {
      if ((1.0 * listb[j].second * lista[i].second) /
              (1.0 * listb[j].first * lista[i].first) ==
          -1.0) {
        if (lista[i].first != listb[j].first &&
            lista[i].second != listb[j].second) {
          flag = 1;
          cout << "YES\n";
          cout << lista[i].first << " " << lista[i].second << "\n";
          cout << 0 << " " << 0 << "\n";
          cout << listb[j].first << " " << listb[j].second << "\n";
        } else
          continue;
      }
      if (flag == 1) break;
    }
    if (flag == 1) break;
  }
  if (flag == 0) cout << "NO";
  return 0;
}
