#include <bits/stdc++.h>
using namespace std;
const int Maxn = 50000000 + 1000;
vector<pair<int, int> > first, second;
int Sqr[Maxn], x, y;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> x >> y;
  for (int i = 1; i < 2000; i++) Sqr[i * i] = i;
  for (int i = 1; i < x; i++) {
    int Now = x * x - i * i;
    if (Sqr[x * x - i * i] != 0) {
      int y1 = Sqr[x * x - i * i], x1 = i;
      for (int I = 1; I < y; I++) {
        int Y = (I * x1) % y1;
        int x2 = I, y2 = -I * x1 / y1;
        if (Y == 0 and x1 != 0 and x2 != 0 and y1 != 0 and y2 != 0 and
            x1 != x2 and y1 != y2 and Sqr[x2 * x2 + y2 * y2] == y) {
          cout << "YES" << endl
               << "0 0" << endl
               << x1 << " " << y1 << endl
               << x2 << " " << y2 << endl;
          return 0;
        }
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
