description: You are given n integers a_1, a_2, …, a_n. Find the maximum value of max(a_l, a_{l + 1}, …, a_r) ⋅ min(a_l, a_{l + 1}, …, a_r) over all pairs (l, r) of integers for which 1 ≤ l < r ≤ n.
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 10 000) — the number of test cases.
  
  The first line of each test case contains a single integer n (2 ≤ n ≤ 10^5).
  
  The second line of each test case contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^6).
  
  It is guaranteed that the sum of n over all test cases doesn't exceed 3 ⋅ 10^5.
  
  Output
  
  For each test case, print a single integer — the maximum possible value of the product from the statement.
  
  Example
  
  Input
  
  
  4
  3
  2 4 3
  4
  3 2 3 1
  2
  69 69
  6
  719313 273225 402638 473783 804745 323328
  
  
  Output
  
  
  12
  6
  4761
  381274500335
  
  Note
  
  Let f(l, r) = max(a_l, a_{l + 1}, …, a_r) ⋅ min(a_l, a_{l + 1}, …, a_r).
  
  In the first test case, 
  
    * f(1, 2) = max(a_1, a_2) ⋅ min(a_1, a_2) = max(2, 4) ⋅ min(2, 4) = 4 ⋅ 2 = 8. 
    * f(1, 3) = max(a_1, a_2, a_3) ⋅ min(a_1, a_2, a_3) = max(2, 4, 3) ⋅ min(2, 4, 3) = 4 ⋅ 2 = 8. 
    * f(2, 3) = max(a_2, a_3) ⋅ min(a_2, a_3) = max(4, 3) ⋅ min(4, 3) = 4 ⋅ 3 = 12. 
  
  
  
  So the maximum is f(2, 3) = 12.
  
  In the second test case, the maximum is f(1, 2) = f(1, 3) = f(2, 3) = 6.
solution: import java.io.*;
  import java.util.*;
  
  public class Main {
  
      public static void main(String[] args) throws Exception {
          int t = io.nextInt();
  //        int t = 1;
          for (int i = 0; i < t; i++) {
              solve();
          }
          io.close();
      }
  
      private static void solve() {
          int n = io.nextInt();
          int[] data = new int[n];
          for (int i = 0; i < n; i++) {
              data[i] = io.nextInt();
          }
          long max = 0;
          for (int i = 0; i < n - 1; i++) {
              max = Math.max((long) Math.max(data[i], data[i + 1]) * Math.min(data[i], data[i + 1]), max);
          }
          io.println(max);
      }
  
      static long pow(long n, int p) {
          if (p == 0) return 1;
          long v = pow(n, p / 2);
          long res = 1;
          if (p % 2 == 1) res = n;
          res *= v;
          res %= 1_000_000_007;
          res *= v;
          res %= 1_000_000_007;
          return res;
      }
  
      static void sort(int[] a) {
          ArrayList<Integer> l = new ArrayList<>(a.length);
          for (int i : a) l.add(i);
          Collections.sort(l);
          for (int i = 0; i < a.length; i++) a[i] = l.get(i);
      }
  
      //-----------PrintWriter for faster output---------------------------------
      public static FastIO io = new FastIO();
  
      //-----------MyScanner class for faster input----------
      static class FastIO extends PrintWriter {
          private InputStream stream;
          private byte[] buf = new byte[1 << 16];
          private int curChar, numChars;
  
          // standard input
          public FastIO() {
              this(System.in, System.out);
          }
  
          public FastIO(InputStream i, OutputStream o) {
              super(o);
              stream = i;
          }
  
          // file input
          public FastIO(String i, String o) throws IOException {
              super(new FileWriter(o));
              stream = new FileInputStream(i);
          }
  
          // throws InputMismatchException() if previously detected end of file
          private int nextByte() {
              if (numChars == -1) throw new InputMismatchException();
              if (curChar >= numChars) {
                  curChar = 0;
                  try {
                      numChars = stream.read(buf);
                  } catch (IOException e) {
                      throw new InputMismatchException();
                  }
                  if (numChars == -1) return -1; // end of file
              }
              return buf[curChar++];
          }
  
          // to read in entire lines, replace c <= ' '
          // with a function that checks whether c is a line break
          public String next() {
              int c;
              do {
                  c = nextByte();
              } while (c <= ' ');
              StringBuilder res = new StringBuilder();
              do {
                  res.appendCodePoint(c);
                  c = nextByte();
              } while (c > ' ');
              return res.toString();
          }
  
          public String nextLine() {
              int c;
              do {
                  c = nextByte();
              } while (c < '\n');
              StringBuilder res = new StringBuilder();
              do {
                  res.appendCodePoint(c);
                  c = nextByte();
              } while (c > '\n');
              return res.toString();
          }
  
          public int nextInt() { // nextLong() would be implemented similarly
              int c;
              do {
                  c = nextByte();
              } while (c <= ' ');
              int sgn = 1;
              if (c == '-') {
                  sgn = -1;
                  c = nextByte();
              }
              int res = 0;
              do {
                  if (c < '0' || c > '9')
                      throw new InputMismatchException();
                  res = 10 * res + c - '0';
                  c = nextByte();
              } while (c > ' ');
              return res * sgn;
          }
  
          public long nextLong() { // nextLong() would be implemented similarly
              int c;
              do {
                  c = nextByte();
              } while (c <= ' ');
              int sgn = 1;
              if (c == '-') {
                  sgn = -1;
                  c = nextByte();
              }
              long res = 0;
              do {
                  if (c < '0' || c > '9')
                      throw new InputMismatchException();
                  res = 10 * res + c - '0';
                  c = nextByte();
              } while (c > ' ');
              return res * sgn;
          }
  
          public double nextDouble() {
              return Double.parseDouble(next());
          }
      }
  //--------------------------------------------------------
  }