#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5000;
int n, m, T, a[N];
int main() {
  cin >> n >> m;
  for (int i = 1; i < n; i++) {
    pair<int, int> a = make_pair(i, (int)sqrt(n * n - i * i));
    if (a.first * a.first + a.second * a.second != n * n) continue;
    pair<int, int> b = make_pair(-(m * a.second) / n, (a.first * m) / n);
    if (b.first * b.first + b.second * b.second != m * m) continue;
    if (a.second == b.second) continue;
    printf("YES\n%d %d %d %d %d %d", a.first, a.second, b.first, b.second, 0,
           0);
    return 0;
  }
  printf("NO");
}
