#include <bits/stdc++.h>
using namespace std;
int x[100], y[100];
int f(int x1, int y1, int x2, int y2, int x3, int y3) {
  int a = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
  int b = (x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3);
  int c = (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3);
  if (a > b) {
    swap(a, b);
  }
  if (b > c) swap(b, c);
  if (a > c) swap(a, c);
  if (a + b == c) {
    return 1;
  } else
    return 0;
}
int main() {
  int a, b;
  int ansx1, ansx2, ansy1, ansy2;
  int xn = 0, yn = 0;
  while (cin >> a >> b) {
    int m = a * a + b * b;
    int ntp = 0;
    for (int i = 1; i <= int(sqrt(m)); i++) {
      int p = m - i * i;
      int sq = int(sqrt(p));
      if (sq * sq == p) {
        x[ntp] = i;
        y[ntp++] = sq;
      }
    }
    if (ntp == 0) {
      cout << "NO" << endl;
      continue;
    }
    for (int i = 0; i < ntp; i++) {
      for (int j = 1; j < x[i]; j++) {
        int temp = a * a - j * j;
        int sq2 = int(sqrt(temp));
        if (sq2 * sq2 == temp) {
          int ansx1 = j - x[i];
          ansx2 = j;
          ansy2 = sq2;
          int temp2 = b * b - ansx1 * ansx1;
          int sq3 = int(sqrt(temp2));
          if (sq3 * sq3 == temp2) {
            if (ansx1 == ansx2 || ansx1 == 0 || ansx2 == 0 || sq3 == ansy2 ||
                sq3 == 0 || ansy2 == 0) {
              goto cont;
            } else if (f(xn, yn, ansx1, sq3, ansx2, ansy2)) {
              cout << "YES" << endl;
              cout << xn << " " << yn << endl;
              cout << ansx1 << " " << sq3 << endl;
              cout << ansx2 << " " << ansy2 << endl;
              goto endW;
            }
          }
        }
      cont:;
        continue;
      }
    }
    cout << "NO" << endl;
  endW:;
  }
  return 0;
}
