#include <bits/stdc++.h>
using namespace std;
int main() {
int t = 0, n[10] = {0};
int a[10][100000];
cin >> t;
for (int i = 0; i < t; i++) {
cin >> n[i];
for (int j = 0; j < n[i]; j++) {
cin >> a[i][j];
}
}
int count = 0, flag = 0;
for (int i = 0; i < t; i++) {
flag = 0;
for (int j = 0; j < n[i]; j++) {
for (int k = 0; k < n[i]; k++) {
if (a[i][j] % a[i][k] == 0) {
count++;
}
}
if (count == n[i]) {
flag = 1;
}
count = 0;
}
if (flag == 1) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
return 0;
}