#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T modinv(T a, T n) {
  T i = n, v = 0, d = 1;
  while (a > 0) {
    T t = i / a, x = a;
    a = i % x;
    i = x;
    x = d;
    d = v - t * x;
    v = x;
  }
  return (v + n) % n;
}
long long modpow(long long n, long long k, long long mod) {
  long long ans = 1;
  while (k > 0) {
    if (k & 1) ans = (ans * n) % mod;
    k >>= 1;
    n = (n * n) % mod;
  }
  return ans % mod;
}
template <class T>
string str(T Number) {
  string Result;
  ostringstream convert;
  convert << Number;
  Result = convert.str();
  return Result;
}
int StringToNumber(const string &Text) {
  istringstream ss(Text);
  int result;
  return ss >> result ? result : 0;
}
template <class T>
inline vector<pair<T, int> > FACTORISE(T n) {
  vector<pair<T, int> > R;
  for (T i = 2; n > 1;) {
    if (n % i == 0) {
      int C = 0;
      for (; n % i == 0; C++, n /= i)
        ;
      R.push_back(make_pair(i, C));
    }
    i++;
    if (i > n / i) i = n;
  }
  if (n > 1) R.push_back(make_pair(n, 1));
  return R;
}
template <class T>
inline T TOTIENT(T n) {
  vector<pair<T, int> > R = FACTORISE(n);
  T r = n;
  for (int i = 0; i < R.size(); i++) r = r / R[i].first * (R[i].first - 1);
  return r;
}
template <class T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
double rnd(float d) { return floor(d + 0.49); }
int main(int argc, char const *argv[]) {
  int a, b;
  cin >> a >> b;
  vector<pair<int, int> > v1, v2;
  for (int i = 1; i <= a; ++i) {
    for (int j = 1; j <= a; ++j) {
      if (i * i + j * j == a * a) {
        v1.push_back(make_pair(i, j));
      }
    }
  }
  for (int i = 1; i <= b; ++i) {
    for (int j = 1; j <= b; ++j) {
      if (i * i + j * j == b * b) {
        v2.push_back(make_pair(i, j));
      }
    }
  }
  int flag = 0;
  pair<int, int> ans1, ans2;
  for (int i = 0; i < ((int)(v1).size()) && flag == 0; ++i) {
    for (int j = 0; flag == 0 && j < ((int)(v2).size()); ++j) {
      int x1 = v1[i].first;
      int y1 = v1[i].second;
      int x2 = v2[j].first;
      int y2 = v2[j].second;
      int f = 0;
      if (x1 * x2 + y1 * y2 == 0 && y1 != y2 && x1 != x2) {
        f = 1;
        ans1 = make_pair(x1, y1);
        ans2 = make_pair(x2, y2);
      }
      if (x1 * x2 - y1 * y2 == 0 && x1 != x2 && y1 != -y2) {
        f = 1;
        ans1 = make_pair(x1, y1);
        ans2 = make_pair(x2, -y2);
      }
      if (y1 * y2 - x1 * x2 == 0 && x1 != -x2 && y1 != y2) {
        f = 1;
        ans1 = make_pair(x1, y1);
        ans2 = make_pair(-x2, y2);
      }
      if (f == 1) {
        flag = 1;
      }
    }
  }
  if (flag == 0) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
    cout << "0 0\n";
    cout << ans1.first << " " << ans1.second << "\n";
    cout << ans2.first << " " << ans2.second << "\n";
  }
  return 0;
}
