#include <bits/stdc++.h>
using namespace std;
inline long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
inline long long int power(long long int a, long long int n, long long int m) {
  if (n == 0) return 1;
  long long int p = power(a, n / 2, m);
  p = (p * p) % m;
  if (n % 2)
    return (p * a) % m;
  else
    return p;
}
const long long int MOD = 1000000007;
bool chk(long long int a, long long int b, long long int c, long long int d) {
  if (b * d == -1 * a * c and a and c and b != d) return true;
  return false;
}
void print(long long int a, long long int b, long long int c, long long int d) {
  cout << "YES"
       << "\n";
  cout << "0 0"
       << "\n";
  cout << a << " " << b << "\n";
  cout << c << " " << d << "\n";
}
int32_t main() {
  long long int a, b;
  cin >> a >> b;
  map<long long int, set<pair<long long int, long long int>>> m;
  for (long long int i = 1; i < 1001; i++) {
    for (long long int j = 1; j < 1001; j++) {
      long long int dis = sqrt(i * i + j * j);
      if (dis * dis == i * i + j * j and dis <= 1000) {
        m[dis].insert({i, j});
      }
    }
  }
  if (m.find(a) == m.end() or m.find(b) == m.end()) {
    cout << "NO";
    return 0;
  }
  long long int x1, x2, y1, y2;
  for (auto it : m[a]) {
    x1 = it.first;
    y1 = it.second;
    for (auto itr : m[b]) {
      x2 = itr.first;
      y2 = itr.second;
      if (chk(x1, y1, -x2, y2)) {
        print(x1, y1, -x2, y2);
        return 0;
      } else if (chk(y1, x1, -y2, x2)) {
        print(y1, x1, -y2, x2);
        return 0;
      } else if (chk(x1, y1, -y2, x2)) {
        print(x1, y1, -y2, x2);
        return 0;
      } else if (chk(y1, x1, -x2, y2)) {
        print(y1, x1, -x2, y2);
        return 0;
      }
    }
  }
  cout << "NO";
}
