#include <bits/stdc++.h>
using namespace std;
void fast_in_out() {
  std::ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
}
int dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
int dy[] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
int lx[] = {2, 2, -1, 1, -2, -2, -1, 1};
int ly[] = {-1, 1, 2, 2, 1, -1, -2, -2};
const long double eps = 1e-9;
const int N = 1e7 + 50, M = 1e5 + 10, mod = 1e8;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) {
  long long t = gcd(a, b);
  return t ? (a / t * b) : 0;
}
int main() {
  fast_in_out();
  vector<pair<int, int>> v1, v2;
  int a, b;
  cin >> a >> b;
  for (int x = 1; x < a; x++) {
    int y = sqrt(a * a - x * x);
    if (a * a == x * x + y * y) {
      v1.emplace_back(x, y);
      v1.emplace_back(-x, y);
      v1.emplace_back(x, -y);
      v1.emplace_back(-x, -y);
    }
  }
  for (int x = 1; x < b; x++) {
    int y = sqrt(b * b - x * x);
    if (b * b == x * x + y * y) {
      v2.emplace_back(x, y);
      v2.emplace_back(-x, y);
      v2.emplace_back(x, -y);
      v2.emplace_back(-x, -y);
    }
  }
  for (auto e1 : v1) {
    for (auto e2 : v2) {
      int x1 = e1.first, x2 = e2.first;
      int y1 = e1.second, y2 = e2.second;
      if (x1 == x2 || y1 == y2) continue;
      int x = x1 - x2, y = y1 - y2;
      x *= x;
      y *= y;
      int d = x + y;
      if (d != a * a + b * b) continue;
      cout << "YES\n";
      cout << "0 0\n" << x1 << " " << y1 << "\n" << x2 << " " << y2 << '\n';
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}
