#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const double PI = acos(-1.0);
const long long int mod = 1e9 + 7;
const int MAXN = 1e6 + 5;
struct point {
  int x, y;
  point() {}
  point(int x, int y) : x(x), y(y) {}
  const point operator*(int s) const { return point(x * s, y * s); }
  const point operator-(const point &p) const {
    return point(x - p.x, y - p.x);
  }
  const point operator+(const point &p) const {
    return point(x + p.x, y + p.x);
  }
};
bool on_boundary(point C, int rad, point test) {
  return (C.x - test.x) * (C.x - test.x) + (C.y - test.y) * (C.y - test.y) ==
         rad * rad;
}
void cp() {
  int a, b;
  cin >> a >> b;
  for (int x = -b; x <= b; x++) {
    for (int y = -b; y <= b; y++) {
      if (x == 0 || y == 0) continue;
      if (on_boundary(point(0, 0), b, point(x, y))) {
        point b_vec = point(x, y);
        point b_vec_normal = point(b_vec.y, -b_vec.x);
        int norm_sq =
            b_vec_normal.x * b_vec_normal.x + b_vec_normal.y * b_vec_normal.y;
        if ((int)sqrt(norm_sq) * (int)sqrt(norm_sq) != norm_sq) continue;
        int norm = sqrt(norm_sq);
        point a_vec = b_vec_normal * a;
        if (abs(a_vec.x) % norm != 0 || abs(a_vec.y) % norm != 0) continue;
        a_vec.x /= norm;
        a_vec.y /= norm;
        point hyp = a_vec - b_vec;
        if (hyp.x == 0 || hyp.y == 0) continue;
        cout << "YES\n";
        cout << b_vec.x << " " << b_vec.y << '\n';
        cout << 0 << " " << 0 << '\n';
        cout << a_vec.x << " " << a_vec.y << '\n';
        return;
      }
    }
  }
  cout << "NO";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  t = 1;
  while (t--) {
    cp();
  }
  return 0;
}
