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 div_2_735_a {
  	public static void main(String args[]){
  		FScanner in = new FScanner();
  		PrintWriter out = new PrintWriter(System.out);
  		int t = in.nextInt();
  		while(t-->0) {
          int n=in.nextInt();
          int a[]=in.readArray(n);
          
          // pro=1;
          long max=0;
  
           for(int i=0;i<n-1;i++)
            {
            	String x=String.valueOf(a[i]);
            	String y=String.valueOf(a[i+1]);
              String res=multiply(x,y);
              long pro=Long.parseLong(res);
             if(max<pro)
             	max=pro;
            }
            out.println(max);
  
  
  		 }
  		out.close();
  	}
  	static String multiply(String num1, String num2)
  {
      int len1 = num1.length();
      int len2 = num2.length();
      if (len1 == 0 || len2 == 0)
          return "0";
   
      
      int result[] = new int[len1 + len2];
   
      
      int i_n1 = 0;
      int i_n2 = 0;
       
      
      for (int i = len1 - 1; i >= 0; i--)
      {
          int carry = 0;
          int n1 = num1.charAt(i) - '0';
   
        
          i_n2 = 0;
           
                   
          for (int j = len2 - 1; j >= 0; j--)
          {
             
              int n2 = num2.charAt(j) - '0';
   
            
              int sum = n1 * n2 + result[i_n1 + i_n2] + carry;
   
         
              carry = sum / 10;
   
             
              result[i_n1 + i_n2] = sum % 10;
   
              i_n2++;
          }
   
          // store carry in next cell
          if (carry > 0)
              result[i_n1 + i_n2] += carry;
   
        
          i_n1++;
      }
   
      int i = result.length - 1;
      while (i >= 0 && result[i] == 0)
      i--;
   
     
      if (i == -1)
      return "0";
   
    
      String s = "";
       
      while (i >= 0)
          s += (result[i--]);
   
      return s;
  }
  
      static class FScanner {
  		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  		StringTokenizer sb = new StringTokenizer("");
   
  		String next(){
  			while(!sb.hasMoreTokens()){
  				try{
  					sb = new StringTokenizer(br.readLine());
  				} catch(IOException e){ }
  			}
  			return sb.nextToken();
  		}
  		String nextLine(){
  			try{ return br.readLine(); } 
  			catch(IOException e) { } return "";
  		}
   
  		int nextInt(){
  			return Integer.parseInt(next());
  		}
   
  		long nextLong() {
  			return Long.parseLong(next());
  		}
   
  		int[] readArray(int n) {
  			int a[] = new int[n];
  			for(int i=0;i<n;i++) a[i] = nextInt();
  			return a;
  		}
   
  		float nextFloat(){
  		return Float.parseFloat(next());
  		}
  		
  		double nextDouble(){
  		return Double.parseDouble(next());
  		}
  	}
  }
  	