#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int sdfg[56465], stf[564], dsrfyt[566], sdrt[6556], dsrt[5664];
    long long int n;
    cin >> n;
    long long int arra[n + 5], bra[n + 5];
    for (long long int i = 0; i < n; i++) cin >> arra[i];
    for (long long int i = 0; i < n; i++)
      ;
    for (long long int i = 0; i < n; i++)
      ;
    for (long long int i = 0; i < n; i++)
      ;
    long long int mx = 0;
    for (long long int i = 0; i < n - 1; i++) {
      long long int val = arra[i] * arra[i + 1];
      mx = max(val, mx);
    }
    for (long long int i = 0; i < n; i++) {
      bra[i] = mx;
    }
    cout << mx << endl;
  }
}
