#include <iostream>
#include <map>
#include <vector>
#include <utility>
#include <algorithm>

using namespace std;


int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int t;
	cin >> t;
	for (int i = 0; i < t; ++i) {
		long long n;
		cin >> n;

		vector<pair<int, long long>> m;

		for (long long j = 2; j * j <= n; ++j) {
			int count = 0;
			while (n % j == 0) {
				count++;
				n /= j;
			}

			if (count > 0) m.push_back({ count, j });
		}

		if (n > 1) m.push_back({ 1, n });

		sort(m.rbegin(), m.rend());

		vector<long long> res(m[0].first, 1);
		for (auto& now : m) {
			for (int j = 0; j < now.first; ++j) res[j] *= now.second;
		}

		cout << res.size() << endl;
		for (int j = res.size() - 1; j >= 0; --j) {
			cout << res[j] << " ";
		}
		cout << "\n";
	}

	return 0;
}