#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<long long, long long> > > adj;
vector<bool> vis;
void solve() {
  long long n, i, j, k, x, y, z, a, b, num1, num2, dem, flag = 0, mi, ma;
  long long x1, x2, y1, y2;
  cin >> a >> b;
  mi = min(a, b);
  ma = max(a, b);
  for (i = 2; i <= mi; i++) {
    if (mi % i == 0 && ma % i == 0) {
      for (j = 1; j < i; j++) {
        x = j * j;
        y = i * i - x;
        z = (long long)sqrt(y);
        if (y == z * z) {
          y1 = (a * z) / i;
          y2 = (b * j) / i;
          if (y1 != y2) {
            num1 = j;
            num2 = z;
            dem = i;
            flag = 1;
            break;
          }
        }
      }
    }
    if (flag == 1) break;
  }
  if (flag == 0) {
    cout << "NO";
    return;
  }
  cout << "YES"
       << "\n";
  x1 = (a * num1) / dem;
  y1 = (a * num2) / dem;
  x2 = (b * num2) / dem;
  y2 = (b * num1) / dem;
  cout << 0 << " " << 0 << "\n";
  cout << x1 << " " << y1 << "\n";
  cout << -x2 << " " << y2 << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t-- > 0) {
    solve();
  }
}
