#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int INF = 1e9 + 7;
const double eps = 1e-6;
const int MAXN = 1e6 + 7;
double len(int a, int b) { return a * a + b * b; }
int main() {
  int a, b;
  ios::sync_with_stdio(false);
  cin >> a >> b;
  for (int x1 = 1; x1 <= a; x1++)
    for (int y1 = 1; y1 <= a; y1++) {
      if (len(x1, y1) == a * a) {
        x1 *= -1;
        for (int x2 = 1; x2 <= b; x2++)
          for (int y2 = 1; y2 <= b; y2++) {
            if (len(x2, y2) == b * b && x1 * x2 + y2 * y1 == 0 && y1 != y2) {
              cout << "YES\n";
              cout << 0 << " " << 0 << endl;
              cout << x1 << " " << y1 << endl;
              cout << x2 << " " << y2 << endl;
              return 0;
            }
          }
        x1 *= -1;
      }
    }
  cout << "NO\n";
  return 0;
}
