#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int N = 1e5 + 5;
vector<pair<int, int> > aa, bb;
bool valid(pair<int, int> p1, pair<int, int> p2) {
  if (p1.first == p2.first || p1.second == p2.second || p1.first == 0 ||
      p1.second == 0 || p2.first == 0 || p2.second == 0)
    return 0;
  if (p1.first * p2.first + p1.second * p2.second != 0) return 0;
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int a, b;
  cin >> a >> b;
  for (int i = 1; i <= a; i++) {
    for (int j = 1; j <= a; j++) {
      if (i * i + j * j == a * a) aa.push_back({i, j});
    }
  }
  for (int i = 1; i <= b; i++) {
    for (int j = 1; j <= b; j++) {
      if (i * i + j * j == b * b) bb.push_back({-i, j});
    }
  }
  for (auto p1 : aa) {
    for (auto p2 : bb) {
      if (valid(p1, p2)) {
        cout << "YES\n";
        cout << "0 0\n";
        cout << p1.first << " " << p1.second << "\n";
        cout << p2.first << " " << p2.second << "\n";
        return 0;
      }
    }
  }
  cout << "NO\n";
  return 0;
}
