#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int c[1000];
  for (int i = 1; i <= 1000; i++) {
    c[i] = i * i;
  }
  if (a == 1 or b == 1) {
    cout << "NO" << endl;
  } else {
    int p = 0;
    int ar1[1000];
    int ar2[1000];
    for (int i = 0; i < a; i++) {
      int s = 0;
      for (int j = 0; j < i; j++) {
        s = (j * j) + (i * i);
        if (s == c[a]) {
          p = p + 1;
          break;
        }
      }
    }
    int h = 0;
    for (int i = 0; i < a; i++) {
      int s = 0;
      for (int j = 0; j < i; j++) {
        s = (j * j) + (i * i);
        if (s == c[a]) {
          ar1[h] = i;
          ar2[h] = j;
          h = h + 1;
          break;
        }
      }
    }
    float z = 0;
    float w = 0;
    int flag = 0;
    int f = 0;
    int u = 0;
    int g = 0;
    int c = 0;
    int y = 0;
    int m = 0;
    int q = 0;
    int o = 0;
    for (int t = 0; t < p; t++) {
      z = (float)ar1[t] / (float)ar2[t];
      y = f + ar1[t];
      u = g + ar2[t];
      for (int i = 0; i < b; i++) {
        int s = 0;
        q = 0;
        for (int j = 0; j < i; j++) {
          s = (j * j) + (i * i);
          if (s == b * b) {
            q = 1;
            if (ar1[t] == i) {
              o = f - j;
              m = g + i;
            } else if (ar1[t] == j) {
              o = f - j;
              m = g + i;
            } else {
              o = f + j;
              m = g - i;
            }
            w = (float)i / (float)j;
            break;
          }
        }
        if (q == 1 and z == w) break;
      }
      if (z == w) break;
    }
    if (q == 1 and z == w) {
      cout << "YES" << endl;
      cout << f << " " << g << endl;
      cout << y << " " << u << endl;
      cout << o << " " << m << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
