#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  for (int i = 1; i < a; i++) {
    int temp = i * i;
    int temp2 = a * a - temp;
    int k = sqrt(temp2);
    if (k * k == temp2) {
      int x2 = b * k;
      int y2 = b * i;
      if (x2 % a == 0 && y2 % a == 0) {
        x2 = x2 / a;
        y2 = y2 / a;
        if (x2 == i && y2 != k) {
          cout << "YES\n";
          cout << 0 << " " << 0 << "\n";
          cout << i << " " << k << "\n";
          cout << -x2 << " " << y2 << "\n";
          return 0;
        } else if (y2 == k && x2 != i) {
          cout << "YES\n";
          cout << 0 << " " << 0 << "\n";
          cout << i << " " << k << "\n";
          cout << x2 << " " << -y2 << "\n";
          return 0;
        } else if (x2 != i && y2 != k) {
          cout << "YES\n";
          cout << 0 << " " << 0 << "\n";
          cout << i << " " << k << "\n";
          cout << x2 << " " << -y2 << "\n";
          return 0;
        } else {
          if (a == b) {
            cout << "YES\n";
            cout << 0 << " " << 0 << "\n";
            cout << i << " " << k << "\n";
            cout << k << " " << -i << "\n";
            return 0;
          }
        }
      }
    }
  }
  cout << "NO\n";
  return 0;
}
