#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
inline bool mina(A &first, B second) {
  return (first > second) ? (first = second, 1) : 0;
}
template <class A, class B>
inline bool maxa(A &first, B second) {
  return (first < second) ? (first = second, 1) : 0;
}
struct Point {
  int first, second;
  Point() {}
  Point(int first, int second) : first(first), second(second) {}
  Point(const Point &p) : first(p.first), second(p.second) {}
  Point operator+(const Point &p) const {
    return Point(first + p.first, second + p.second);
  }
  Point operator-(const Point &p) const {
    return Point(first - p.first, second - p.second);
  }
  Point operator*(int c) const { return Point(first * c, second * c); }
  Point operator/(int c) const { return Point(first / c, second / c); }
  bool operator<(const Point &p) const {
    return make_pair(second, first) < make_pair(p.second, p.first);
  }
  bool operator==(const Point &p) const {
    return make_pair(second, first) == make_pair(p.second, p.first);
  }
};
int cross(Point p, Point q) { return p.first * q.second - p.second * q.first; }
int area2(Point a, Point b, Point c) {
  return cross(a, b) + cross(b, c) + cross(c, a);
}
int dot(Point p, Point q) { return p.first * q.first + p.second * q.second; }
int dist2(Point p, Point q) { return dot(p - q, p - q); }
int cal(int first, int second) {
  int temp = first * first - second * second;
  int z = sqrt(temp);
  if (z * z < temp) z++;
  if (z * z + second * second != first * first) return -1;
  return z;
}
int main() {
  int A, B;
  cin >> A >> B;
  for (int p = 1; p < A; p++) {
    for (int r = 1; r < B; r++) {
      int q = cal(A, p);
      int s = cal(B, r);
      if (q == -1 || s == -1) continue;
      Point n(p, q);
      Point m(-r, s);
      if (m.second == n.second || m.first == n.first) continue;
      if (dist2(n, m) == A * A + B * B) {
        cout << "YES" << endl;
        cout << "0 0" << endl;
        cout << n.first << " " << n.second << endl;
        cout << m.first << " " << m.second << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
