#include <bits/stdc++.h>
using namespace std;
int a, b;
vector<array<int, 2>> pointsa, pointsb;
void find1(int a) {
  for (int i = 1; i < a; i++) {
    for (int j = i + 1; j < a; j++) {
      if (i * i + j * j == a * a) {
        pointsa.push_back({i, j});
      }
    }
  }
}
void find2(int a) {
  for (int i = 1; i < a; i++) {
    for (int j = i + 1; j < a; j++) {
      if (i * i + j * j == a * a) {
        pointsb.push_back({i, j});
      }
    }
  }
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> a >> b;
  find1(a);
  find2(b);
  if (pointsa.size() == 0) {
    cout << "NO";
    return 0;
  }
  if (pointsb.size() == 0) {
    cout << "NO";
    return 0;
  }
  for (int i = 0; i < (int)pointsa.size(); i++) {
    for (int j = 0; j < (int)pointsb.size(); j++) {
      int c1 = pointsa[i][0];
      int d1 = pointsa[i][1];
      int c2 = pointsb[j][0];
      int d2 = pointsb[j][1];
      int e = gcd(d1, c1);
      int f = gcd(d2, c2);
      if (c1 / e == c2 / f && d1 / e == d2 / f) {
        cout << "YES\n";
        cout << "0 0\n";
        if (c1 == d2) {
          swap(c1, d1);
          swap(c2, d2);
        }
        cout << d1 << " " << c1 << "\n";
        cout << -c2 << " " << d2;
        return 0;
      }
    }
  }
  cout << "NO";
}
