There is a right triangle with legs of length a and b. Your task is to determine whether it is possible to locate the triangle on the plane in such a way that none of its sides is parallel to the coordinate axes. All the vertices must have integer coordinates. If there exists such a location, you have to output the appropriate coordinates of vertices.

Input

The first line contains two integers a, b (1 ≤ a, b ≤ 1000), separated by a single space.

Output

In the first line print either "YES" or "NO" (without the quotes) depending on whether the required location exists. If it does, print in the next three lines three pairs of integers — the coordinates of the triangle vertices, one pair per line. The coordinates must be integers, not exceeding 109 in their absolute value.

Examples

Input

1 1


Output

NO


Input

5 5


Output

YES
2 1
5 5
-2 4


Input

5 10


Output

YES
-10 4
-2 -2
1 2
#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1000000000000000000;
long long mod = 1000000009;
long double pi = 3.141592653589793238;
void pls() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long mul_mod(long long a, long long b, long long m) {
  long long x = 0, y = a;
  while (b > 0) {
    if (b & 1) {
      x = (x + y) % m;
    }
    y = (y + y) % m;
    b >>= 1;
  }
  return x;
}
inline long long modu(long long val, long long modul) {
  return (val % modul + modul) % modul;
}
inline int madd(int x, int y) { return (x % mod + y % mod) % mod; }
inline int msub(int x, int y) { return (mod + x % mod - y % mod) % mod; }
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long powmod(long long a, long long mod, long long p) {
  if (p == 0) return 1;
  long long res;
  long long x = powmod(a, mod, p / 2);
  res = x;
  if (p & 1) x = mul_mod(x, a, mod);
  return mul_mod(x, res, mod);
}
long long exp(long long a, long long p) {
  if (p == 0) return 1;
  long long res;
  long long x = exp(a, p / 2);
  res = x;
  if (p & 1) x = (x * a);
  return (x * res);
}
long long sqt(long long x) {
  long long l = 1LL;
  long long r = x;
  long long res;
  while (l <= r) {
    long long mid = l + (r - l) / 2;
    if (mid * mid <= x) {
      res = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  return res;
}
bool isprime(long long n) {
  for (int i = 2; i <= sqt(n); i++)
    if (n % i == 0) return 0;
  return 1;
}
vector<int> soe(long long upto) {
  vector<bool> prime(upto + 1, 0);
  prime[1] = 1;
  prime[0] = 1;
  for (int i = 2; i <= sqt(upto); i++) {
    if (!prime[i]) {
      for (int j = 2 * i; j <= upto; j += i) prime[j] = 1;
    }
  }
  vector<int> res;
  res.push_back(2);
  for (int i = 3; i < prime.size(); i += 2) {
    if (!prime[i]) res.push_back(i);
  }
  return res;
}
int di[8] = {-1, -1, -1, 1, 1, 1, 0, 0};
int dj[8] = {-1, 0, 1, -1, 0, 1, -1, 1};
int ii[4] = {0, 0, -1, 1};
int jj[4] = {-1, 1, 0, 0};
int n, k;
void solve() {
  int a, b;
  cin >> a >> b;
  int mx = max(b, a);
  vector<pair<int, int>> aa, bb;
  for (long long i = -1; i >= -mx; i--) {
    for (long long j = 1; j <= mx; j++) {
      if (i * i + j * j == b * b) {
        aa.push_back({i, j});
      }
      if (i * i + j * j == a * a) {
        bb.push_back({-i, j});
      }
    }
  }
  bool ok = false;
  for (int i = 0; i < aa.size(); i++) {
    for (int j = 0; j < bb.size(); j++) {
      if ((aa[i].first * bb[j].first + aa[i].second * bb[j].second) == 0 &&
          aa[i].second != bb[j].second) {
        ok = true;
        cout << "YES" << endl;
        cout << aa[i].first << " " << aa[i].second << endl;
        cout << "0"
             << " " << 0 << endl;
        cout << bb[j].first << " " << bb[j].second << endl;
        break;
      }
    }
    if (ok) break;
  }
  if (!ok) {
    cout << "NO" << endl;
  }
}
int main() {
  pls();
  solve();
  return 0;
}
