#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long T = 1;
  cin >> T;
  while (T--) {
    vector<long long> v;
    long long n;
    cin >> n;
    for (int i = 0; i < n; i++) {
      long long val;
      cin >> val;
      v.push_back(val);
    }
    long long maxi = -1;
    for (int i = 0; i < n; i++) {
      long long prev = i > 0 ? v[i - 1] : 0;
      long long next = i + 1 < n ? v[i + 1] : 0;
      maxi = max(maxi, v[i] * max(prev, next));
    }
    cout << maxi << endl;
  }
  return 0;
}
