#include<bits/stdc++.h>
 
using namespace std;
 
int count(int n) {
	int k = 0;
	while (n % 2 == 0) {
		k++;
		n /= 2;
	}
	for (int p = 3; p <= n / p; p += 2)
		while (n % p == 0) {
			k++;
			n /= p;
		}
	if (n > 1)
		k++;
	return k;
}
 
int main() {
	int t; cin >> t;
	while (t--) {
		int a, b, k; cin >> a >> b >> k;
		if (k == 1) {
			cout << (a != b && (a % b == 0 || b % a == 0) ? "YES" : "NO") << '\n';
			continue;
		}
		int x = count(a);
		int y = count(b);
		if (k > x + y) {
			cout << "NO\n";
			continue;
		}
		cout << "YES\n";
	}
	return 0;
}