#include using namespace std; const int N = 503; int n; int t; long long a[N]; long long ans; long long gcd(long long a, long long b){ if (b == 0) return a; else return gcd(b,a % b); } long long lca(long long a,long long b){ return (a * b) / gcd(a,b); } int main(){ //freopen("2.in.txt","r",stdin); //freopen("2.out.txt","w",stdout); cin >> t; while(t --> 0){ cin >> n; ans = 1e18; for(int i = 0; i < n; ++i) cin >> a[i]; for(int i = 0; i < n; ++i){ for(int j = i + 1; j < n; ++j){ ans = min(ans,lca(a[i], a[j])); } } cout << ans << "\n"; } return 0; }