Chef has an array of N natural numbers. Cheffina challenges the chef to choose the two numbers from the array and following the condition as the area of the rectangle formed from the two numbers is maximum. Cheffina also asks the chef to choose two numbers different from the previous two to form the rectangle with a minimum area.

-----Input:-----
- First-line will contain $T$, the number of test cases. Then the test cases follow. 
- Each test case contains a single line of input, $N$.
- N space-separated natural numbers. 

-----Output:-----
For each test case, output in one line answers maximum and minimum area of a rectangle.

-----Constraints-----
- $1 \leq T \leq 10$
- $4 \leq N \leq 10^5$
- $1 \leq arr[i] \leq 10^6$

-----Sample Input:-----
1
5
4 2 1 5 3

-----Sample Output:-----
20 2

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
sys.setrecursionlimit(100000000)
ii = lambda : int(input())
si = lambda : input()
jn = lambda x, l: x.join(map(str, l))
sl = lambda : list(map(str, input().strip()))
mi = lambda : map(int, input().split())
mif = lambda : map(float, input().split())
lii = lambda : list(map(int, input().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
mod = 1000000007
for _ in range(ii()):
	n = ii()
	arr = lii()
	arr.sort()
	ma = arr[-1] * arr[-2]
	mi = arr[0] * arr[1]
	print(ma, mi)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(a[-1] * a[-2], a[0] * a[1])


testcases = int(input())
for x in range(testcases):
	size = int(input())
	li = list(map(int, input().split()))
	highmax = max(li)
	lowmin = min(li)
	new_list = set(li)
	new_list.remove(max(new_list))
	new_list.remove(min(new_list))
	secondhighmax = max(new_list)
	secondmin = min(new_list)
	print(highmax * secondhighmax, lowmin * secondmin)


n = int(input())
for _ in range(n):
	k = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	print(a[k - 1] * a[k - 2], a[0] * a[1])


t = int(input())
for i in range(0, t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	p = set(l)
	pp = list(p)
	maxx = pp[n - 1] * pp[n - 2]
	minn = pp[0] * pp[1]
	print(maxx, minn)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	(mini, maxi) = (l[0] * l[1], l[-1] * l[-2])
	print(maxi, mini)


t = int(input())
for _ in range(t):
	a = int(input())
	b = list(map(int, input().split()))
	b.sort()
	print(b[-1] * b[-2], b[0] * b[1])


import itertools
t = int(input())
for i in range(t):
	n = int(input())
	a = [int(a) for a in input().split()]
	a.sort()
	print(a[len(a) - 1] * a[len(a) - 2], a[0] * a[1])


for i in range(int(input())):
	N = int(input())
	arr = sorted(list(map(int, input().split())))
	print(arr[-1] * arr[-2], arr[0] * arr[1], sep=' ')


from sys import *
input = stdin.readline
for u in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(l[-1] * l[-2], l[0] * l[1])


for _ in range(int(input())):
	n = int(input())
	ls = list(map(int, input().split()))
	ls = sorted(ls)
	print(ls[-2] * ls[-1], end=' ')
	print(ls[0] * ls[1])


t = int(input())
while t > 0:
	n = int(input())
	list_n = list(map(int, input().split()))
	list_n = sorted(list_n)
	print(list_n[-1] * list_n[-2], list_n[0] * list_n[1])
	t -= 1


for i in range(int(input())):
	N = int(input())
	Arr = list(map(int, input().split()))
	Arr.sort()
	print(Arr[-1] * Arr[-2], Arr[0] * Arr[1])


T = int(input())
for _ in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(arr[-1] * arr[-2], arr[0] * arr[1])


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	print(l[-1] * l[-2], end=' ')
	print(l[0] * l[1])


for _ in range(int(input())):
	(n, s, s2) = (int(input()), 1, 1)
	arr = list(map(int, input().split()))
	s = s * max(arr)
	arr.remove(max(arr))
	s *= max(arr)
	s2 *= min(arr)
	arr.remove(min(arr))
	s2 *= min(arr)
	print(s, s2)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(l[-1] * l[-2], end=' ')
	print(l[0] * l[1])