#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e15;
const long long N = 1e5 + 5;
long long n, a[N];
void Input() {
  cin >> n;
  long long S = 0;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
    if (i > 1) S = max(S, a[i] * a[i - 1]);
  }
  cout << S << '\n';
}
void Solve() {}
int main() {
  if (fopen("trash.inp", "r"))
    freopen("trash.inp", "r", stdin), freopen("trash.out", "w", stdout);
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int Test;
  cin >> Test;
  while (Test--) {
    Input();
    Solve();
  }
}
