#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio();
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    long long A[n];
    for (int i = 0; i < n; i++) {
      cin >> A[i];
    }
    long long max_s = INT_MIN;
    for (int j = 0; j < n - 1; j++) {
      if (max_s < (A[j] * A[j + 1])) {
        max_s = (A[j] * A[j + 1]);
      }
    }
    cout << max_s << endl;
  }
}
