#include <bits/stdc++.h>
using namespace std;
long long a[1001][3], b[1001][3], n, k, o, m, f;
int main() {
  cin >> n >> m;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j < n; j++) {
      if (i * i + j * j == n * n) o++, a[o][1] = i, a[o][2] = j;
    }
  }
  for (int i = 1; i < m; i++) {
    for (int j = 1; j < m; j++) {
      if (i * i + j * j == m * m) k++, b[k][1] = i, b[k][2] = j;
    }
  }
  for (int i = 1; i <= o; i++) {
    for (int j = 1; j <= k; j++) {
      if (f) continue;
      if (b[j][1] * a[i][1] == b[j][2] * a[i][2]) {
        if (b[j][1] != a[i][1] || b[j][2] != a[i][2]) {
          f = 1;
          if (b[j][1] == a[i][1])
            b[j][1] *= -1;
          else
            b[j][2] *= -1;
          cout << "YES" << endl
               << 0 << " " << 0 << endl
               << b[j][1] << " " << b[j][2] << endl
               << a[i][1] << " " << a[i][2];
        }
      }
    }
  }
  if (!f) cout << "NO";
}
