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.util.*;
  import static java.lang.Math.toIntExact;
  
  public class Cherry {
      public static void main(String[] args) {
          Scanner sc = new Scanner(System.in);
          long k = sc.nextLong();
  
          for (int i=0; i<k; i++) {
              long n = sc.nextLong();
              long[] arr = new long[toIntExact(n)];
              for(long j=0; j<n; j++){
                  arr[toIntExact(j)] = sc.nextLong();
              }
  
              long l = 0;
              long r = l + 1;
              long[] arr2 = new long[toIntExact(n)-1];
              for (long j=0; j<n-1; j++){
                  arr2[toIntExact(j)] = arr[toIntExact(l)]*arr[toIntExact(r)];
                  l++;
                  r++;
              }
              System.out.println(Arrays.stream(arr2).max().getAsLong());
          }
      }
  }
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
             
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
             
  
  
  
  
  
  
  
          /*Scanner sc = new Scanner(System.in);
          int k = sc.nextInt();
          
  
          for (int i=0; i<k; i++) {
  
              int n = sc.nextInt();
              int[] dummekackzahlen = new int[n];
              for (int j=0; j<n; j++){
                  dummekackzahlen[j] = sc.nextInt();
              }
  
              BigInteger momentanderkingindembiz= BigInteger.valueOf(0);
              for (int x=0; x<n-1; x++){
                  for (int y=x+1; y<n; y++){
                      momentanderkingindembiz = (f(dummekackzahlen,x,y).compareTo(momentanderkingindembiz)==1)?f(dummekackzahlen,x,y):momentanderkingindembiz;
                  }
              } 
              
              System.out.println(momentanderkingindembiz);
          }
      }
  
  
      public static int max(int[] a, int links, int rechts){
          int max=0;
          for (int i=links; i<=rechts; i++){
              max = max<a[i]?a[i]:max;
          }
          return max;
      }
  
      public static int min(int[] a, int links, int rechts){
          int min=a[links];
          for (int i=links; i<=rechts; i++){
              min= min>a[i]?a[i]:min;
          }
          return min;
      }
  
      public static BigInteger f(int[] a, int links, int rechts){
          return BigInteger.valueOf(max(a,links,rechts)).multiply(BigInteger.valueOf(min(a,links,rechts))); */
  
  
  
  
  
  
  
  
  
  
  
  
             
                   
  /*Scanner sc = new Scanner(System.in);
          int n = sc.nextInt();
          for (int i=0; i<n; i++) {
              int z = sc.nextInt();
              int[] xa = new int[z];
              int l = 0;
              int r = l+1;
              int[] xc = new int[z];
                  for (int m=0; m<z; m++) {
                  
                      int k = sc.nextInt();
                      xa[m] = k;
                  }
                  for (int u=0; u<z; u++){
                      int[] xb = new int[r-l+1];
                      for (int s=0; s<(r-l); s++){
                          xb[s] = xa[s];
                      }
                      int min = Arrays.stream(xb).min().getAsInt();
                      int max = Arrays.stream(xb).max().getAsInt();
                      xc[u] = min * max;
                  }
                  System.out.println(Arrays.stream(xc).max().getAsInt());
                  System.out.println("Max mutter, die olle fotze stinkt")
              }
              */  