#define _GLIBCXX_FILESYSTEM
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve() {
int n;
cin >> n;
vector<int> a(n+1);
for(int i = 1; i <= n; i++) {
cin >> a[i];
}
int ans = 0;
for(int i = 1; i <= 100; i++) {
for(int j = i; j <= 100; j++) {
int x = 0, y = 0, z = 0;
for(int k = 1; k <= n; k++) {
if(a[k] % i == 0 and a[k] % j == 0) z++;
else if(a[k] % i == 0) x++;
else if(a[k] % j == 0) y++;
}
int r1 = max(0,(n+1)/2 - x);
int r2 = max(0,n/2 - y);
if(r1 + r2 == z) ans = max(ans,i+j);
r1 = max(0,n/2 - x);
r2 = max(0,(n+1)/2 - y);
if(r1 + r2 == z) ans = max(ans,i+j);
}
}
cout << ans << '\n';
return;
}
int32_t main() {
ios_base::sync_with_stdio(false);cin.tie(NULL);
int tc = 1;
cin >> tc;
for(int kase = 1; kase <= tc; kase++) {
//cout << "Case " << kase << ": ";
solve();
}
return 0;
}