#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << "\n";
  err(++it, args...);
}
const double PI = acos(-1);
const double eps = (1e-9);
const long long int INF = 2e9;
const int M = (1e9) + 7;
const int N = 403;
struct Point {
  int x, y;
  Point(int a = 0, int b = 0) { x = a, y = b; }
  void reassign(int a, int b) { x = a, y = b; }
  void input() { scanf("%d%d", &x, &y); }
  void print() { printf("%d %d\n", x, y); }
  Point operator+=(Point A) {
    x += A.x, y += A.y;
    return *this;
  }
  Point operator-=(Point A) {
    x -= A.x, y -= A.y;
    return *this;
  }
  Point operator+(Point A) {
    Point tp(x + A.x, y + A.y);
    return tp;
  }
  Point operator-(Point A) {
    Point tp(x - A.x, y - A.y);
    return tp;
  }
  Point operator*(int f) {
    Point tp(x * f, y * f);
    return tp;
  }
  Point operator*=(int f) {
    x *= f, y *= f;
    return *this;
  }
  Point operator/=(int f) {
    x /= f, y /= f;
    return *this;
  }
  bool operator==(Point A) {
    if (x == A.x && y == A.y) return true;
    return false;
  }
  bool operator!=(Point A) {
    if (x != A.x || y != A.y) return true;
    return false;
  }
  void ulta() { swap(x, y); }
};
Point makepoint(int a, int b) {
  Point temp(a, b);
  return temp;
}
void swap(Point &A, Point &B) {
  swap(A.x, B.x);
  swap(A.y, B.y);
}
bool cmp(Point a, Point b) {
  if (a.x != b.x) return (a.x < b.x);
  return (a.y < b.y);
}
long long int dotproduct(Point a, Point b) {
  return (long long int)a.x * (long long int)b.x +
         (long long int)a.y * (long long int)b.y;
}
long long int crossproduct(Point a, Point b) {
  return (long long int)a.x * (long long int)b.y -
         (long long int)a.y * (long long int)b.x;
}
int ccw(Point a, Point b, Point origin = makepoint(0, 0)) {
  long long int x = crossproduct(a - origin, b - origin);
  if (x > 0) x = 1;
  if (x < 0) x = -1;
  return (int)x;
}
long long int sqrdist(Point a, Point b = makepoint(0, 0)) {
  long long int q = 0, temp;
  temp = a.x - b.x;
  temp *= temp, q += temp;
  temp = a.y - b.y;
  temp *= temp, q += temp;
  return q;
}
double dist(Point a, Point b = makepoint(0, 0)) {
  long long int temp = sqrdist(a, b);
  return sqrt(temp);
}
double anglepolar(Point a) { return atan2(a.y, a.x); }
double anglebetween(Point a, Point b, Point origin = makepoint(0, 0)) {
  return atan2(crossproduct(a - origin, b - origin),
               dotproduct(a - origin, b - origin));
}
Point perp(Point a) { return makepoint(-a.y, a.x); }
struct Line {
  Point a, b, ab;
  bool isline;
  Line() {
    a = makepoint(0, 0);
    b = a, ab = a, isline = 0;
  }
  Line(Point p, Point q) {
    a = p, b = q;
    ab = b - a;
    if (a != b)
      isline = 1;
    else
      isline = 0;
  }
  void update(Point p, Point q) {
    a = p, b = q;
    ab = b - a;
    if (a != b)
      isline = 1;
    else
      isline = 0;
    return;
  }
  bool operator==(Line other) {
    return ((crossproduct(ab, other.ab) == 0) && online(other.a));
  }
  bool online(Point point) {
    if (!isline) return (point == a);
    return (crossproduct(point - a, ab) == 0);
  }
  bool onsegment(Point point) {
    if (!isline) return (point == a);
    Point va, vb;
    va = a - point, vb = b - point;
    return (crossproduct(va, vb) == 0 && dotproduct(va, vb) <= 0);
  }
  bool parallel(Line other) { return (crossproduct(ab, other.ab) == 0); }
  bool perpendicular(Line other) { return (dotproduct(ab, other.ab) == 0); }
  double distline(Point point) {
    if (!isline) return dist(a, point);
    long double t = abs(crossproduct(point - a, ab));
    t /= dist(ab);
    return t;
  }
  double distsegment(Point point) {
    if (dotproduct(point - a, ab) <= 0) return dist(a, point);
    if (dotproduct(point - b, ab) >= 0) return dist(b, point);
    return distline(point);
  }
  bool lineintersectcheck(Line ray) { return (crossproduct(ab, ray.ab) != 0); }
  bool inter1(int a, int b, int c, int d) {
    if (a > b) swap(a, b);
    if (c > d) swap(c, d);
    return max(a, c) <= min(b, d);
  }
  bool segmentintersectcheck(Line ray) {
    if (crossproduct(ab, ray.ab) == 0) {
      if (online(ray.a))
        return inter1(a.x, b.x, ray.a.x, ray.b.x) &&
               inter1(a.y, b.y, ray.a.y, ray.b.y);
      return false;
    }
    return (crossproduct(ray.a - a, ray.a - b) !=
            crossproduct(ray.b - a, ray.b - b)) &&
           (crossproduct(a - ray.a, a - ray.b) !=
            crossproduct(b - ray.a, b - ray.b));
  }
};
int squarechecker(vector<Point> &point) {
  if (point[0] == point[2] || point[1] == point[3]) return 0;
  double x = dist(point[0], point[3]);
  if (dist(point[0], point[1]) == x && dist(point[1], point[2]) == x &&
      dist(point[2], point[3]) == x)
    return (dotproduct(point[1] - point[2], point[3] - point[2]) == 0);
  return 0;
}
vector<Point> v1;
vector<Point> v2;
void triplet(int x, vector<Point> &v) {
  int a, b;
  for (a = 1; a < x; ++a) {
    for (b = 1; b < x; ++b) {
      if (a * a + b * b == x * x) v.emplace_back(makepoint(a, b));
    }
  }
}
int main() {
  int i, j, n, m;
  scanf("%d%d", &n, &m);
  triplet(n, v1);
  triplet(m, v2);
  Point origin = makepoint(0, 0);
  Point p1, p2;
  for (i = 0; i < v1.size(); ++i) {
    for (j = 0; j < v2.size(); ++j) {
      p1 = v1[i], p2 = v2[j];
      if (p1.x > p1.y) p1.ulta();
      if (p2.x < p2.y) p2.ulta();
      if (p1.x * p2.x == p1.y * p2.y) {
        p1.x *= -1;
        if (p1.y == p2.y) p1.ulta(), p2.ulta(), p1 *= (-1);
        printf("YES\n");
        p1.print();
        p2.print();
        origin.print();
        exit(0);
      }
    }
  }
  printf("NO\n");
}
