#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return a * b / gcd(a, b);
}
long long int min(long long int a, long long int b) {
  if (a < b) return a;
  return b;
}
long long int bins(long long int arr[], long long int l, long long int r,
                   long long int x) {
  if (r >= l) {
    long long int mid = l + (r - l) / 2;
    if (arr[mid] == x) return mid;
    if (arr[mid] > x) return bins(arr, l, mid - 1, x);
    return bins(arr, mid + 1, r, x);
  }
  return -1;
}
long long int modi(long long int a, long long int m) {
  return power(a, m - 2, m);
}
long long int modeq(long long int a, long long int m) {
  return (a % m + m) % m;
}
long long int isPowerof2(int n) { return (n && !(n & (n - 1))); }
long long int collinear(long long int x1, long long int x2, long long int x3,
                        long long int y1, long long int y2, long long int y3) {
  long long int res = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2);
  if (res == 0) {
    return 1;
  } else {
    return 0;
  }
}
int isSubstring(string s1, string s2) {
  int M = s1.length();
  int N = s2.length();
  for (int i = 0; i <= N - M; i++) {
    int j;
    for (j = 0; j < M; j++)
      if (s2[i + j] != s1[j]) break;
    if (j == M) return i;
  }
  return -1;
}
int main() {
  long long int a, b;
  cin >> a >> b;
  vector<pair<long long int, long long int> > a1;
  vector<pair<long long int, long long int> > a2;
  for (long long int i = -(a - 1); i < a - 1; i++) {
    if ((sqrt(a * a - i * i)) == (int)sqrt(a * a - i * i)) {
      a1.push_back({i, (int)sqrt(a * a - i * i)});
    }
  }
  for (long long int i = -(b - 1); i < b - 1; i++) {
    if ((sqrt(b * b - i * i)) == (int)sqrt(b * b - i * i)) {
      a2.push_back({i, (int)sqrt(b * b - i * i)});
    }
  }
  long long int f = 0;
  long long int x1, x2, y1, y2;
  for (long long int i = 0; i < a1.size(); i++) {
    for (long long int j = 0; j < a2.size(); j++) {
      if (a1[i].first != a2[j].first && a1[i].second != a2[j].second &&
          a1[i].first != 0 && a1[i].second != 0 && a2[j].first != 0 &&
          a2[j].second != 0 &&
          a1[i].first * a2[j].first == -1 * (a1[i].second * a2[j].second)) {
        x1 = a1[i].first;
        x2 = a2[j].first;
        y1 = a1[i].second;
        y2 = a2[j].second;
        f = 1;
        break;
      }
    }
    if (f == 1) {
      break;
    }
  }
  if (f == 0) {
    cout << "NO";
  }
  if (f == 1) {
    cout << "YES"
         << "\n";
    cout << 0 << " " << 0 << "\n";
    cout << x1 << " " << y1 << "\n";
    cout << x2 << " " << y2 << "\n";
  }
}
