#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, arr[100], brr[100], crr[100], drr[100], i, j, c = 0, c1 = 0;
  cin >> a >> b;
  for (i = 1; i < a; i++) {
    for (j = i; j < a; j++) {
      if (i * i + j * j == a * a) {
        arr[c] = i;
        brr[c++] = j;
        arr[c] = j;
        brr[c++] = i;
        arr[c] = -1 * i;
        brr[c++] = j;
        arr[c] = -1 * j;
        brr[c++] = i;
      }
    }
  }
  for (i = 1; i < b; i++) {
    for (j = i; j < b; j++) {
      if (i * i + j * j == b * b) {
        crr[c1] = i;
        drr[c1++] = j;
        crr[c1] = j;
        drr[c1++] = i;
        crr[c1] = -1 * i;
        drr[c1++] = j;
        crr[c1] = -1 * j;
        drr[c1++] = i;
      }
    }
  }
  int flag = 0;
  for (i = 0; i < c; i++) {
    for (j = 0; j < c1; j++) {
      if ((arr[i] - crr[j]) * (arr[i] - crr[j]) +
                  (brr[i] - drr[j]) * (brr[i] - drr[j]) ==
              a * a + b * b &&
          arr[i] != crr[j] && brr[i] != drr[j]) {
        cout << "YES" << endl;
        cout << arr[i] << "\t" << brr[i] << endl;
        cout << crr[j] << "\t" << drr[j] << endl;
        cout << "0\t0" << endl;
        flag = 1;
        break;
      }
    }
    if (flag == 1) break;
  }
  if (flag != 1) cout << "NO" << endl;
  return 0;
}
