#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int c = a * a + b * b;
  int d = a * a - b * b;
  int e = b * b - a * a;
  for (int m = 1; m <= 2; m++) {
    for (int i = 1; i <= 1000; i++)
      for (int j = 1; j <= 1000; j++)
        if ((i * i + j * j) == a * a) {
          for (int k = -1000; k <= 1000; k++)
            for (int l = -1000; l <= 1000; l++)
              if (i != k && k != 0 && l != j && l != 0) {
                int tmp = ((i - k) * (i - k)) + ((l - j) * (l - j));
                if (((k) * (k)) + ((l) * (l)) == b * b) {
                  if (tmp == c || tmp == d || tmp == e) {
                    puts("YES");
                    cout << 0 << " " << 0 << " " << endl
                         << i << " " << j << endl
                         << k << " " << l << endl;
                    return 0;
                  }
                } else if ((((i - k) * (i - k)) + ((j - l) * (j - l))) ==
                           ((b) * (b))) {
                  int x = ((k) * (k)) + ((l) * (l));
                  if (x == c || x == d || x == e) {
                    puts("YES");
                    cout << 0 << " " << 0 << " " << endl
                         << i << " " << j << endl
                         << k << " " << l << endl;
                    return 0;
                  }
                }
              }
        }
    swap(a, b);
  }
  puts("NO");
  return 0;
}
