#include <bits/stdc++.h>
using namespace std;
long long int a, b;
long double y2_;
long long int fn(long long int x) {
  long double num = a * a - x * x;
  long double n = sqrt(num);
  if (ceil(n) != floor(n)) return -1;
  if (n == 0) return -1;
  return (long long int)n;
}
bool dist(long long int x, long long int y) {
  long double dis = sqrt(x * x + y * y);
  if (dis == b)
    return true;
  else
    return false;
}
bool check(long long int x1, long long int y1, long long int x2) {
  if (x2 == 0) return false;
  y2_ = (x1 * -1 * x2) / (long double)y1;
  if (ceil(y2_) != floor(y2_)) return false;
  if (y2_ == 0) return false;
  if (!dist(x2, y2_)) return false;
  if (y1 == y2_) return false;
  return true;
}
void solve() {
  cin >> a >> b;
  for (long long int x1 = -a; x1 <= a; x1++) {
    if (x1 == 0) continue;
    long long int y1 = fn(x1);
    if (y1 == -1) continue;
    for (long long int x2 = -b; x2 <= b; x2++) {
      if (x1 == x2) continue;
      if (check(x1, y1, x2)) {
        cout << "YES" << endl
             << 0 << " " << 0 << endl
             << x1 << " " << y1 << "\n"
             << x2 << " " << (long long int)y2_ << "\n";
        return;
      }
      if (check(x1, -y1, x2)) {
        printf("YES\n");
        cout << "YES" << endl
             << 0 << " " << 0 << endl
             << x1 << " " << y1 << "\n"
             << x2 << " " << (long long int)y2_ << "\n";
        return;
      }
    }
  }
  cout << "NO" << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
}
