#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t--) { int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; for (int j = 0; j < i; j++) { long long g = __gcd(a[i], a[j]); a[i] /= g; a[j] /= g; } } bool ok = true; for (int i = 0; i < n; i++) { int x = round(sqrt(a[i])); if (1LL * x * x != a[i]) { ok = false; } } cout << (ok ? "Yes\n" : "No\n"); } }