#include <bits/stdc++.h>
using namespace std;
const long long mxN = 1e5 + 1;
long long n, r, k;
int32_t main() {
  int a, b, x, y;
  cin >> a >> b;
  for (int i = 1; i < a; i++) {
    x = i;
    y = sqrt(a * a - x * x);
    if (x * x + y * y != a * a) continue;
    int X = -(y * b) / a, Y = (x * b) / a;
    if (X * X + Y * Y != b * b) continue;
    if (x == X or y == Y) continue;
    cout << "YES" << endl;
    cout << "0 0" << endl;
    cout << x << ' ' << y << endl;
    cout << X << ' ' << Y << endl;
    return 0;
  }
  cout << "NO" << endl;
}
