#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
long long sq(long long x) { return (x * x); }
vector<pair<long long, long long> > A, B;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long a, b;
  cin >> a >> b;
  for (long long i = 1; i < a; i++) {
    for (long long j = 1; j < a; j++) {
      if (sq(i) + sq(j) == sq(a)) {
        A.push_back({i, j});
      }
    }
  }
  for (long long i = 1; i < b; i++) {
    for (long long j = 1; j < b; j++) {
      if (sq(i) + sq(j) == sq(b)) {
        B.push_back({-i, j});
      }
    }
  }
  debug() << " ["
          << "A"
             ": "
          << (A)
          << "] "
             " ["
          << "B"
             ": "
          << (B) << "] ";
  long long s1 = (long long)A.size(), s2 = (long long)B.size();
  for (long long i = 0; i < s1; i++) {
    for (long long j = 0; j < s2; j++) {
      pair<long long, long long> t1 = A[i], t2 = B[j];
      if (t1.first == 0 || t2.first == 0 || t1.second == 0 || t2.second == 0)
        continue;
      if (t1.first == t2.first || t1.second == t2.second) continue;
      if ((sq(t1.first - t2.first) + sq(t1.second - t2.second)) !=
          (sq(a) + sq(b)))
        continue;
      cout << "YES\n";
      cout << "0 0\n";
      cout << t1.first << " " << t1.second << "\n";
      cout << t2.first << " " << t2.second << "\n";
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}
