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 static java.util.Arrays.asList;
  import static java.util.stream.Collectors.toList;
  
  import java.io.BufferedReader;
  import java.io.ByteArrayOutputStream;
  import java.io.Closeable;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.io.PrintStream;
  import java.net.URISyntaxException;
  import java.nio.file.Files;
  import java.nio.file.Path;
  import java.nio.file.Paths;
  import java.util.Comparator;
  import java.util.List;
  import java.util.StringTokenizer;
  import java.util.function.Supplier;
  import java.util.stream.Stream;
  
  /**
   * A. Cherry
   * @see <a href="https://codeforces.com/contest/1554/problem/A">https://codeforces.com/contest/1554/problem/A</a>
   */
  public class Main {
  
      private final boolean sample;
      private final InputStream in;
      private final PrintStream out;
      
      public Main(
              final Boolean sample, final InputStream in, final PrintStream out) {
          this.sample = sample;
          this.in = in;
          this.out = out;
      }
      
      @SuppressWarnings("unused")
      private void log(final Supplier<Object> supplier) {
          if (!sample) {
              return;
          }
          System.out.println(supplier.get());
      }
      
      private Result<?> handleTestCase(final Integer i, final FastScanner sc) {
          final int n = sc.nextInt();
          final int[] a = new int[n];
          for (int j = 0; j < n; j++) {
              a[j] = sc.nextInt();
          }
          final long ans = Stream.iterate(1, j -> j < n, j -> j + 1)
                  .map(j -> (long) a[j] * a[j - 1])
                  .max(Comparator.naturalOrder())
                  .orElseThrow();
          return new Result<>(i, List.of(ans));
      }
      
      public void solve() {
          try (final FastScanner sc = new FastScanner(this.in)) {
              final int numberOfTestCases = sc.nextInt();
              final List<Result<?>> results
                      = Stream.iterate(1, i -> i <= numberOfTestCases, i -> i + 1)
                              .map(i -> handleTestCase(i, sc))
                              .collect(toList());
              output(results);
          }
      }
  
      private void output(final List<Result<?>> results) {
          results.forEach(r -> {
              r.getValues().stream().map(Object::toString).forEach(this.out::println);
          });
      }
      
      public static void main(final String[] args) throws IOException, URISyntaxException {
          final boolean sample = isSample();
          final InputStream is;
          final PrintStream out;
          final ByteArrayOutputStream baos = new ByteArrayOutputStream();
          long timerStart = 0;
          if (sample) {
              is = Main.class.getResourceAsStream("sample.in");
              out = new PrintStream(baos, true);
              timerStart = System.nanoTime();
          } else {
              is = System.in;
              out = System.out;
          }
          
          new Main(sample, is, out).solve();
          
          out.flush();
          if (sample) {
              final long timeSpent = (System.nanoTime() - timerStart) / 1_000;
              final double time;
              final String unit;
              if (timeSpent < 1_000) {
                  time = timeSpent;
                  unit = "µs";
              } else if (timeSpent < 1_000_000) {
                  time = timeSpent / 1_000.0;
                  unit = "ms";
              } else {
                  time = timeSpent / 1_000_000.0;
                  unit = "s";
              }
              final Path path
                      = Paths.get(Main.class.getResource("sample.out").toURI());
              final List<String> expected = Files.readAllLines(path);
              final List<String> actual = asList(baos.toString().split("\\r?\\n"));
              if (!expected.equals(actual)) {
                  throw new AssertionError(String.format(
                          "Expected %s, got %s", expected, actual));
              }
              actual.forEach(System.out::println);
              System.out.println(String.format("took: %.3f %s", time, unit));
          }
      }
      
      private static boolean isSample() {
          try {
              return "sample".equals(System.getProperty("codeforces"));
          } catch (final SecurityException e) {
              return false;
          }
      }
      
      private static final class FastScanner implements Closeable {
          private final BufferedReader br;
          private StringTokenizer st;
          
          public FastScanner(final InputStream in) {
              this.br = new BufferedReader(new InputStreamReader(in));
              st = new StringTokenizer("");
          }
          
          public String next() {
              while (!st.hasMoreTokens()) {
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (final IOException e) {
                      throw new RuntimeException(e);
                  }
              }
              return st.nextToken();
          }
      
          public int nextInt() {
              return Integer.parseInt(next());
          }
          
          @SuppressWarnings("unused")
          public long nextLong() {
              return Long.parseLong(next());
          }
  
          @Override
          public void close() {
              try {
                  this.br.close();
              } catch (final IOException e) {
                  // ignore
              }
          }
      }
      
      private static final class Result<T> {
          @SuppressWarnings("unused")
          private final int number;
          private final List<T> values;
          
          public Result(final int number, final List<T> values) {
              this.number = number;
              this.values = values;
          }
  
          public List<T> getValues() {
              return values;
          }
      }
  }
  