#include <bits/stdc++.h>
using namespace std;
pair<int, int> ans[3];
int main() {
  int a, b, f1 = 0, f2 = 0;
  cin >> a >> b;
  int len = max(a, b);
  for (int i = 1; f1 == 0 && i <= len; i++)
    for (int j = 1; f1 == 0 && j <= len; j++) {
      if (a * a == i * i + j * j) {
        ans[1].first = i;
        ans[1].second = j;
        ans[2].first = ans[1].first * b;
        ans[2].second = ans[1].second * b;
        if (ans[2].first % a != 0 || ans[2].second % a != 0) continue;
        ans[2].first /= a;
        ans[2].second /= a;
        if (ans[1].first * ans[2].second - ans[1].second * ans[2].first == 0) {
          if (ans[1].first != ans[2].second && ans[1].second != -ans[2].first)
            f1 = 1;
          if (ans[1].first != -ans[2].second && ans[1].second != ans[2].first)
            f1 = 2;
        }
      }
    }
  if (f1 != 0) {
    cout << "YES" << endl;
    cout << 0 << ' ' << 0 << endl;
    if (f1 == 1) {
      cout << ans[1].first << ' ' << ans[1].second << endl;
      cout << ans[2].second << ' ' << -ans[2].first << endl;
    }
    if (f1 == 2) {
      cout << ans[1].first << ' ' << ans[1].second << endl;
      cout << -ans[2].second << ' ' << ans[2].first << endl;
    }
  } else
    cout << "NO" << endl;
  return 0;
}
