#include <bits/stdc++.h>
using namespace std;
const int N = 1e3;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int a, b;
  cin >> a >> b;
  for (int x = 1; x <= a; ++x) {
    int y = sqrt(a * a - x * x);
    if (y && y * y + x * x == a * a) {
      if ((b * x) % a) continue;
      if ((b * y) % a) continue;
      int ty = (b * x) / a;
      int tx = -(b * y) / a;
      if (y != ty) {
        cout << "YES" << endl;
        cout << "0 0" << endl;
        cout << x << " " << y << endl;
        cout << tx << " " << ty << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
}
