#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long i, j;
    long long a = -1, b = -1, c = -1;
    for (i = 2; i <= 1000; i++) {
      if (a != -1) break;
      for (j = 2; j <= 1000; j++) {
        if (i == j || n % i != 0 || n % j != 0) continue;
        long long z = n / (i * j);
        if (z != i && z != j && z != 1) {
          a = i;
          b = j;
          c = z;
          break;
        }
      }
    }
    if (a != -1) {
      cout << "YES" << endl;
      cout << a << " " << b << " " << c << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
