#include<bits/stdc++.h>
#define rep(i,st,en) for(int i=st;i<=en;i++)
#define REP(i,st,en) for(int i=st;i>=en;i--)
#define con continue
#define endl printf("\n");
using namespace std;
typedef long long ll;
int t,a,b,k,cnt1,cnt2;

int main()
{
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d%d%d",&a,&b,&k);
		int x=a,y=b;
		if(x>y)swap(x,y),swap(a,b);
		cnt1=cnt2=0;
		for(int i=2;i*i<=a;i++)
			while(a%i==0)
				a/=i,cnt1++;
		if(a>1)
			cnt1++;
		for(int i=2;i*i<=b;i++)
			while(b%i==0)
				b/=i,cnt2++;
		if(b>1)cnt2++;
		if(cnt1+cnt2<k)
		{
			printf("No\n");
			con;
		}		
		if(x==y&&k==1)
		{
			printf("No\n");
			con;
		}
		if(x!=y&&y/x*x!=y&&k<2)
		{
			printf("No\n");
			con;
		}
		printf("Yes");
		endl;
		
	}
	return 0;
}