#include <bits/stdc++.h>
using namespace std;
long long fpow(long long x, long long y, long long p = 1000000007) {
  x = x % p;
  long long sum = 1;
  while (y) {
    if (y & 1) sum = sum * x;
    sum %= p;
    y = y >> 1;
    x = x * x;
    x %= p;
  }
  return sum;
}
long long fact[3000007] = {0};
void facto() {
  fact[0] = 1;
  fact[1] = 1;
  for (long long i = 2; i < 3000007; i++)
    fact[i] = (fact[i - 1] * i) % 1000000007;
}
long long ncr(long long n, long long r) {
  if (r > n) return 0;
  long long res = 1;
  res = fact[n];
  res = (res * (fpow(fact[r], 1000000007 - 2))) % 1000000007;
  res = (res * (fpow(fact[n - r], 1000000007 - 2))) % 1000000007;
  return res;
}
long long npr(long long n, long long r) {
  if (r > n) return 0;
  long long res = 1;
  res = fact[n];
  res = (res * (fpow(fact[n - r], 1000000007 - 2))) % 1000000007;
  return res;
}
long long mul(long long x, long long y) { return (x * y) % 1000000007; }
long long add(long long x, long long y) { return (x + y) % 1000000007; }
long long sub(long long x, long long y) {
  return (x - y + 1000000007) % 1000000007;
}
long long expomod(long long x, long long y) {
  long long result = 1;
  x %= 1000000007;
  while (y > 0) {
    if (y & 1) {
      result = (1ll * result * x) % 1000000007;
    }
    y = y >> 1;
    x = (1ll * x * x) % 1000000007;
  }
  return result;
}
vector<long long> v;
void inline in(long long n) {
  v.resize(n + 1);
  for (long long i = 1; i <= n; i++) {
    cin >> v[i];
  }
}
long long f[35];
long long ans, f1;
void add(long long x) {
  for (long long i = 31; i >= 0; i--) {
    if (x & (1LL << i)) {
      f[i] += 1;
    }
  }
}
void remove(long long x) {
  for (long long i = 31; i >= 0; i--) {
    if (x & (1LL << i)) {
      f[i]--;
      if (f[i] == 0) {
        ans ^= (1LL << i);
      }
    }
  }
}
void go() {
  long long k;
  cin >> k;
  long long fg = 0;
  for (long long i = 2; i * i * i <= (k); i++) {
    if (k % i == 0) {
      for (long long j = i + 1; j * j <= (k / i); j++) {
        if ((k / i) % j == 0) {
          if (j != (k / i) / j) {
            cout << "YES"
                 << "\n"
                 << i << " " << j << " " << (k / i) / j << "\n";
            fg = 1;
            break;
          }
        }
      }
    }
    if (fg) {
      break;
    }
  }
  if (!fg) {
    cout << "NO"
         << "\n";
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    go();
  }
}
