#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:167177216")
using namespace std;
const int INF = 1e9;
const long double eps = 1e-12;
const long long mod = INF + 7;
const long long INF64 = (long long)(INF) * (long long)(INF);
const int ddx[] = {-1, 1, 1, -1};
const int ddy[] = {1, 1, -1, -1};
const int dx[] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int dx4[] = {-1, 0, 1, 0};
const int dy4[] = {0, 1, 0, -1};
const int dxh[] = {-2, -2, -1, 1, 2, 2, 1, -1};
const int dyh[] = {1, -1, -2, -2, -1, 1, 2, 2};
const string dirs[] = {"RIGHT", "UP", "LEFT", "DOWN"};
const long double pi = acos(-1.0);
int check(int n) {
  if (n <= 0) return 0;
  int l = 1, r = 1000;
  while (r - l > 1) {
    int mid = (l + r) / 2;
    if (mid * mid > n)
      r = mid;
    else
      l = mid;
  }
  for (int i = l; i <= r; i++)
    if (i * i == n) return i;
  return 0;
}
set<int> sqr;
int main() {
  int a, b;
  cin >> a >> b;
  for (int x1 = -1000; x1 <= 1000; x1++)
    for (int x2 = -1000; x2 <= 1000; x2++)
      if (x1 != x2 && x1 != 0 && x2 != 0) {
        int h1 = a * a - x1 * x1;
        if (check(h1) == 0) continue;
        h1 = check(h1);
        int h2 = b * b - x2 * x2;
        if (check(h2) == 0) continue;
        h2 = check(h2);
        int y11, y22;
        y11 = h1;
        y22 = h2;
        if (y11 != y22 && x1 * x1 + y11 * y11 == a * a &&
            x2 * x2 + y22 * y22 == b * b &&
            (x1 - x2) * (x1 - x2) + (y11 - y22) * (y11 - y22) ==
                a * a + b * b) {
          cout << "YES" << endl;
          cout << 0 << ' ' << 0 << endl;
          cout << x1 << ' ' << y11 << endl;
          cout << x2 << ' ' << y22 << endl;
          return 0;
        }
        y11 = -h1;
        y22 = h2;
        if (y11 != y22 && x1 * x1 + y11 * y11 == a * a &&
            x2 * x2 + y22 * y22 == b * b &&
            (x1 - x2) * (x1 - x2) + (y11 - y22) * (y11 - y22) ==
                a * a + b * b) {
          cout << "YES" << endl;
          cout << 0 << ' ' << 0 << endl;
          cout << x1 << ' ' << y11 << endl;
          cout << x2 << ' ' << y22 << endl;
          return 0;
        }
        y11 = -h1;
        y22 = -h2;
        if (y11 != y22 && x1 * x1 + y11 * y11 == a * a &&
            x2 * x2 + y22 * y22 == b * b &&
            (x1 - x2) * (x1 - x2) + (y11 - y22) * (y11 - y22) ==
                a * a + b * b) {
          cout << "YES" << endl;
          cout << 0 << ' ' << 0 << endl;
          cout << x1 << ' ' << y11 << endl;
          cout << x2 << ' ' << y22 << endl;
          return 0;
        }
        y11 = h1;
        y22 = -h2;
        if (y11 != y22 && x1 * x1 + y11 * y11 == a * a &&
            x2 * x2 + y22 * y22 == b * b &&
            (x1 - x2) * (x1 - x2) + (y11 - y22) * (y11 - y22) ==
                a * a + b * b) {
          cout << "YES" << endl;
          cout << 0 << ' ' << 0 << endl;
          cout << x1 << ' ' << y11 << endl;
          cout << x2 << ' ' << y22 << endl;
          return 0;
        }
      }
  for (int x1 = -1000; x1 <= 1000; x1++)
    for (int x2 = -1000; x2 <= 1000; x2++)
      if (x1 != x2 && x1 != 0 && x2 != 0) {
        int h1 = b * b - x1 * x1;
        if (check(h1) == 0) continue;
        h1 = check(h1);
        int h2 = a * a - x2 * x2;
        if (check(h2) == 0) continue;
        h2 = check(h2);
        int y11, y22;
        y11 = h1;
        y22 = h2;
        if (y11 != y22 && x1 * x1 + y11 * y11 == b * b &&
            x2 * x2 + y22 * y22 == a * a &&
            (x1 - x2) * (x1 - x2) + (y11 - y22) * (y11 - y22) ==
                a * a + b * b) {
          cout << "YES" << endl;
          cout << 0 << ' ' << 0 << endl;
          cout << x1 << ' ' << y11 << endl;
          cout << x2 << ' ' << y22 << endl;
          return 0;
        }
        y11 = -h1;
        y22 = h2;
        if (y11 != y22 && x1 * x1 + y11 * y11 == b * b &&
            x2 * x2 + y22 * y22 == a * a &&
            (x1 - x2) * (x1 - x2) + (y11 - y22) * (y11 - y22) ==
                a * a + b * b) {
          cout << "YES" << endl;
          cout << 0 << ' ' << 0 << endl;
          cout << x1 << ' ' << y11 << endl;
          cout << x2 << ' ' << y22 << endl;
          return 0;
        }
        y11 = -h1;
        y22 = -h2;
        if (y11 != y22 && x1 * x1 + y11 * y11 == b * b &&
            x2 * x2 + y22 * y22 == a * a &&
            (x1 - x2) * (x1 - x2) + (y11 - y22) * (y11 - y22) ==
                a * a + b * b) {
          cout << "YES" << endl;
          cout << 0 << ' ' << 0 << endl;
          cout << x1 << ' ' << y11 << endl;
          cout << x2 << ' ' << y22 << endl;
          return 0;
        }
        y11 = h1;
        y22 = -h2;
        if (y11 != y22 && x1 * x1 + y11 * y11 == b * b &&
            x2 * x2 + y22 * y22 == a * a &&
            (x1 - x2) * (x1 - x2) + (y11 - y22) * (y11 - y22) ==
                a * a + b * b) {
          cout << "YES" << endl;
          cout << 0 << ' ' << 0 << endl;
          cout << x1 << ' ' << y11 << endl;
          cout << x2 << ' ' << y22 << endl;
          return 0;
        }
      }
  cout << "NO" << endl;
  return 0;
}
