#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
template <typename... Args>
void writeln(Args... args) {
  ((cout << args << " "), ...);
  cout << endl;
}
template <typename... Args>
void _db(Args... args) {
  ((cerr << args << " ;; "), ...);
  cout << endl;
}
vector<pair<int, int>> get_points(int dist) {
  dist *= dist;
  vector<pair<int, int>> v;
  for (int f = 1; f * f < dist; ++f) {
    int s_sqr = dist - f * f;
    int s = sqrt(s_sqr);
    if (s * s == s_sqr) {
      v.push_back({f, s});
    }
  }
  return v;
}
int main() {
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  auto v1 = get_points(a);
  auto v2 = get_points(b);
  for (auto& p1 : v1) {
    for (auto& p2 : v2) {
      if (p1.first * p2.first == p1.second * p2.second) {
        int sx = -p2.first;
        int sy = p2.second;
        if (sx == p1.first || sy == p1.second) {
          sx *= -1;
          sy *= -1;
        }
        if (sx == p1.first || sy == p1.second) {
          continue;
        }
        cout << "YES" << endl;
        cout << 0 << " " << 0 << endl;
        cout << p1.first << " " << p1.second << endl;
        cout << sx << " " << sy << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
