int gcd(int, int);
using namespace std;
int main(){
int n;
int m;
int a;
int b;
cin>>n;
for(int i=0;i<n;i++){
cin>>m;
b=0;
if(m==1){
cin>>b;
cout<<"Yes"<<endl;
continue;
}else{
cin>>a>>b;
b/=gcd(a,b);
for(int j=2;j<m;j++){
cin>>a;
b/=gcd(a,b);
}
if(b==1)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
}
return 0;
}
int gcd(int a,int b){
if(a<b)swap(a,b);
return b==0?a:gcd(b,a%b);
}