#include <bits/stdc++.h>
using namespace std;
bool isPerfectSquare(long long int n) {
  for (long long int i = 1; i * i <= n; i++) {
    if ((n % i == 0) && (n / i == i)) {
      return true;
    }
  }
  return false;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int a, b;
  cin >> a >> b;
  for (long long int i = 1; i < a; i++) {
    if (isPerfectSquare(a * a - i * i)) {
      long long int y = sqrt(a * a - i * i);
      long long int temp = gcd(i, y);
      long long int bx = -y / temp, by = i / temp;
      long long int modB = sqrt(bx * bx + by * by);
      if (modB && b % modB == 0) {
        if (y != by * (b / modB)) {
          cout << "YES\n0 0" << endl;
          cout << i << " " << y << endl;
          cout << bx * (b / modB) << " " << by * (b / modB) << endl;
          return 0;
        }
      }
    }
  }
  cout << "NO" << endl;
}
