#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  int p = 2;
  while (p * p <= n) {
    if (prime[p]) {
      for (int j = p * p; j <= n; j += p) {
        prime[j] = false;
      }
    }
    p++;
  }
  vector<int> primes;
  for (int i = 2; i <= n; i++) {
    if (prime[i]) primes.emplace_back(i);
  }
  int rem = n - 30;
  if (rem > 0 and rem != 6 and rem != 14 and rem != 10) {
    cout << "YES"
         << "\n";
    cout << "6 10 14 " << rem << "\n";
  } else if (rem - 1 > 0 and (rem - 1) != 6 and (rem - 1) != 10 and
             (rem - 1) != 15) {
    rem--;
    cout << "YES"
         << "\n";
    cout << "6 10 15 " << rem << "\n";
  } else
    cout << "NO"
         << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
