Monocarp wants to draw four line segments on a sheet of paper. He wants the $i$-th segment to have its length equal to $a_i$ ($1 \le i \le 4$). These segments can intersect with each other, and each segment should be either horizontal or vertical.

Monocarp wants to draw the segments in such a way that they enclose a rectangular space, and the area of that rectangular space should be maximum possible.

For example, if Monocarp wants to draw four segments with lengths $1$, $2$, $3$ and $4$, he can do it the following way:

Here, Monocarp has drawn segments $AB$ (with length $1$), $CD$ (with length $2$), $BC$ (with length $3$) and $EF$ (with length $4$). He got a rectangle $ABCF$ with area equal to $3$ that is enclosed by the segments.

Calculate the maximum area of a rectangle Monocarp can enclose with four segments.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 3 \cdot 10^4$) — the number of test cases.

Each test case consists of a single line containing four integers $a_1$, $a_2$, $a_3$, $a_4$ ($1 \le a_i \le 10^4$) — the lengths of the segments Monocarp wants to draw.


-----Output-----

For each test case, print one integer — the maximum area of a rectangle Monocarp can enclose with four segments (it can be shown that the answer is always an integer).


-----Examples-----

Input
4
1 2 3 4
5 5 5 5
3 1 4 1
100 20 20 100
Output
3
25
3
2000


-----Note-----

The first test case of the example is described in the statement.

For the second test case, Monocarp can draw the segments $AB$, $BC$, $CD$ and $DA$ as follows:

Here, Monocarp has drawn segments $AB$ (with length $5$), $BC$ (with length $5$), $CD$ (with length $5$) and $DA$ (with length $5$). He got a rectangle $ABCD$ with area equal to $25$ that is enclosed by the segments.

Difficulty: EASY

Solutions:
n = int(input())
res = []
for i in range(n):
	b = [int(x) for x in input().split()]
	b.sort()
	res.append(b[0] * b[2])
for i in res:
	print(i)


t = int(input())
lis = []
for i in range(t):
	segments = input()
	seg = segments.split()
	for b in seg:
		lis.append(int(b))
	lis.sort()
	print(lis[0] * lis[2])
	lis = []


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


test_cases = input()
segment_array = []
for i in range(int(test_cases)):
	segment = input().split(' ')
	segment = [int(number) for number in segment]
	segment.sort()
	segment_array.append(segment)
for segment in segment_array:
	print(segment[0] * segment[2])


t = int(input())
for i in range(t):
	a = input().split()
	b = list(map(lambda x: int(x), a))
	b.sort()
	area = b[0] * b[2]
	print(area)


for _ in range(int(input())):
	x = list(map(int, input().split()))
	y1 = min(x)
	y2 = max(x)
	x.remove(y1)
	x.remove(y2)
	y3 = max(x)
	y4 = min(x)
	print(abs(min(y1, y4) * min(y2, y3)))


x = int(input())
for i in range(x):
	m = list(map(int, input().split()))[:4]
	m.sort()
	print(m[0] * m[2])


import math
import sys
import itertools
import fractions
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
for t in wtf[1:]:
	A = sorted(map(int, t.split()))
	print(A[0] * A[2])


for _ in range(int(input())):
	l = list(map(int, input().split()))
	l.sort()
	x = min(l[2], l[3])
	y = min(l[0], l[1])
	print(x * y)


for _ in range(int(input())):
	p = [int(x) for x in input().split()]
	p.sort()
	(a, b, c, d) = p
	print(min(a, b) * min(c, d))


for _ in [*open(0)][1:]:
	a = sorted(list(map(int, _.split())))
	print(a[0] * a[2])


for i in range(int(input())):
	a = [int(j) for j in input().split()]
	a.sort()
	print(a[0] * a[2])


t = int(input())
for _ in range(t):
	a = sorted([int(x) for x in input().split()])
	print(a[0] * a[2])


t = int(input())
for i in range(0, t):
	array = input().split()
	array = [int(x) for x in array]
	array.sort()
	print(array[0] * array[2])


import os
import sys
from io import BytesIO, IOBase
import math
from collections import defaultdict, deque
from itertools import combinations
import random
BUFSIZE = 8192
MOD = pow(10, 9) + 7

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	l = list(map(int, input().split(' ')))
	l.sort()
	print(min(l[0], l[1]) * min(l[2], l[3]))


n = int(input())
while n:
	l = list(map(int, input().split()))
	l.sort()
	print(l[0] * l[-2])
	n -= 1


t = int(input())
for i in range(t):
	n = list(map(int, input().split()))
	n.sort()
	print(min(n[0], n[1]) * min(n[2], n[3]))


for i in range(int(input())):
	arr = [int(i) for i in input().split()]
	arr.sort()
	mini = arr[0]
	maxi = arr[-2]
	print(mini * maxi)


t = int(input())
while t != 0:
	aa = [int(k) for k in input().split()]
	aa.sort(reverse=True)
	print(aa[1] * aa[3])
	t = t - 1


for _ in range(int(input())):
	arr = sorted(list(map(int, input().split())))
	print(arr[0] * arr[2])


import itertools
for _ in range(int(input())):
	A = [int(i) for i in input().split()]
	mx = 0
	for perm in itertools.permutations(A):
		mx = max(mx, min(perm[0], perm[1]) * min(perm[2], perm[3]))
	print(mx)


import math
import sys

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

def solve():
	a = Read.list_int()
	a.sort()
	print(a[0] * a[2])
query_count = Read.int()
while query_count:
	query_count -= 1
	solve()


def solve():
	n = [int(x) for x in input().split()]
	n.sort()
	print(n[0] * n[2])
t = int(input())
while t > 0:
	solve()
	t -= 1


t = int(input())
out = ''
while t > 0:
	arr = [int(item) for item in input().split()]
	arr.sort()
	a1 = min(arr[0], arr[2]) * min(arr[1], arr[3])
	a2 = min(arr[0], arr[1]) * min(arr[2], arr[3])
	out += str(max(a1, a2))
	t = t - 1
	out += '\n'
print(out)


for _ in range(0, int(input())):
	(a, b, c, d) = sorted(map(int, input().split()))
	print(min(a, b) * min(c, d))


for _ in range(int(input())):
	data = sorted(map(int, input().split()))
	print(data[0] * data[2])


n = int(input())
for i in range(n):
	l = input()
	l = l.split()
	s = [int(l[0]), int(l[1]), int(l[2]), int(l[3])]
	s.sort()
	a = s[0] * s[2]
	print(a)


for t in range(int(input())):
	length = list(map(int, input().split()))
	length.sort()
	print(length[0] * length[2])


n = int(input())
for i in range(n):
	arr = []
	arr = list(map(int, input().split(' ')))
	arr.sort()
	ans = arr[0] * arr[2]
	print(ans)


from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
	a = sorted([int(x) for x in input().split()])
	print(a[0] * a[2])


for _ in range(int(input())):
	l = list(map(int, input().split()))
	l1 = []
	for i in range(4):
		l1 = l1 + [max(l)]
		l.remove(l1[i])
	print(l1[1] * l1[3])


n = int(input())
for _ in range(n):
	s = [int(x) for x in input().split()]
	s.sort()
	print(int(s[0] * s[2]))


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


t = int(input())
for i in range(t):
	a = list(map(int, input().split()))
	a.sort()
	d = min(a[0], a[1])
	f = min(a[2], a[3])
	result = d * f
	print(result)


T = int(input())
for i in range(T):
	A = sorted(list(map(int, input().split())))
	result = A[0] * A[2]
	print(result)


t = int(input())
for _ in range(t):
	a = [int(i) for i in input().split()]
	a.sort()
	print(min(a[0], a[1]) * min(a[2], a[3]))


for z in range(int(input())):
	l = sorted([int(x) for x in input().split()])
	print(l[0] * l[2])


import math
n = int(input())
l1 = [0]
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	minimum = min(a, b, c, d)
	arr = [a, b, c, d]
	arr.sort(reverse=False)
	area = minimum * arr[2]
	l1.append(area)
for i in range(n):
	print(l1[i + 1])


from sys import stdin
T = int(stdin.readline())
for t in range(T):
	nums = [int(x) for x in stdin.readline().split()]
	nums.sort()
	print(nums[0] * nums[2])


t = int(input())
ans = ''
for j in range(t):
	a = sorted([int(i) for i in input().split()])
	ans += str(a[0] * a[2]) + '\n'
print(ans)


import sys
zz = 1
sys.setrecursionlimit(10 ** 5)
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def ii():
	return input().rstrip()

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def gtc(tc, ans):
	print('Case #' + str(tc) + ':', ans)

def cil(n, m):
	return n // m + int(n % m > 0)

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j, n, m):
	return 0 <= i < n and 0 <= j < m

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()
uu = t
while t > 0:
	t -= 1
	a = li()
	a.sort()
	print(a[0] * a[2])


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def msi():
	return map(str, input().split())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	return x * y // gcd(x, y)
mod = 1000000007

def modInverse(b, m):
	g = gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def modu(a, b, m):
	a = a % m
	inv = modInverse(b, m)
	if inv == -1:
		return -999999999
	else:
		return inv * a % m
from math import log, factorial, cos, tan, sin, radians, floor
import bisect
from decimal import *
getcontext().prec = 8
abc = 'abcdefghijklmnopqrstuvwxyz'
pi = 3.141592653589793

def gcd1(a):
	if len(a) == 1:
		return a[0]
	ans = a[0]
	for i in range(1, len(a)):
		ans = gcd(ans, a[i])
	return ans

def main():
	for _ in range(ii()):
		l = li()
		l.sort(reverse=True)
		print(l[1] * l[3])
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
while t > 0:
	lis = list(map(int, input().split()))
	ma = min(lis)
	print(sorted(lis)[-(len(lis) - 2)] * ma)
	t -= 1


import sys
sys.setrecursionlimit(1000000)
from collections import defaultdict, deque, Counter
from itertools import permutations
from math import sqrt, gcd, pi, factorial
from functools import reduce
from sys import stdin
from bisect import bisect_right, bisect_left
from copy import copy

def solve(a):
	a = sorted(a)
	return a[0] * a[2]
t = int(input())
anss = [0 for _ in range(t)]
for i in range(t):
	a = list(map(int, input().split()))
	anss[i] = solve(a)
for ans in anss:
	print(ans)


tcases = int(input())
for i in range(tcases):
	a = list(map(lambda x: int(x), input().split()))
	a.sort()
	print(min(a[:2]) * min(a[2:]))


t = int(input())
arr = []
for _ in range(t):
	a = input()
	a = a.split(' ')
	a = [int(k) for k in a]
	a.sort()
	arr.append(a)
for i in arr:
	print(i[0] * i[2])


for i in range(int(input())):
	l = list(map(int, input().split()))
	x = min(l)
	y = max(l)
	l.sort(reverse=True)
	sm = l[1]
	print(sm * x)


for _ in range(int(input())):
	(a, b, c, d) = sorted(list(map(int, input().split())))
	print(a * c)


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


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


import math
t = int(input())
for _ in range(t):
	a = list(map(int, input().split()))
	(a, b, c, d) = (a[0], a[1], a[2], a[3])
	r1 = min(a, b) * min(c, d)
	r2 = min(a, c) * min(b, d)
	r3 = min(a, d) * min(b, c)
	print(max(r1, r2, r3))


try:
	t = int(input())
	while t != 0:
		arr = list(map(int, input().split()))
		arr.sort()
		a = min(arr[0], arr[1])
		b = min(arr[2], arr[3])
		print(a * b)
		t -= 1
except EOFError:
	print(' ')


import sys
test_count = int(sys.stdin.readline())
tests = []
for _ in range(test_count):
	tests.append(sys.stdin.readline())
for test in tests:
	values = sorted(map(int, test.strip().split(' ')))
	answer = values[0] * values[2]
	sys.stdout.write(f'{answer}\n')


from sys import stdin

def main():
	(readln, out) = (stdin.readline, list())
	for i in range(int(readln())):
		a = sorted(map(int, readln().split()))
		out.append(a[0] * a[2])
	print(*out, sep='\n')
main()


n = int(input())
for i in range(n):
	x = list(map(int, input().split()))
	x.sort()
	print(x[0] * x[2])


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


def solve(li):
	li.sort()
	return li[0] * li[2]
testcases = int(input())
for _ in range(testcases):
	li = list(map(int, input().split()))
	print(solve(li))


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


for _ in range(int(input())):
	numbers = [int(x) for x in input().split(' ')]
	numbers.sort()
	print(numbers[0] * numbers[2])


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


for _ in range(int(input())):
	li = [int(i) for i in input().split()]
	li.sort()
	print(li[0] * li[2])


import math
x = int(input())
for i in range(x):
	num = input()
	lst = list(map(int, num.strip().split()))
	lst.sort()
	print(lst[0] * lst[2])


for test in range(int(input())):
	li = list(map(int, input().split()))
	li.sort()
	print(li[0] * li[2])


def solve(arr):
	a1 = arr[0]
	a2 = arr[1]
	a3 = arr[2]
	a4 = arr[3]
	area1 = min(a1, a2) * min(a3, a4)
	area2 = min(a1, a3) * min(a2, a4)
	area3 = min(a1, a4) * min(a2, a3)
	return max(area1, area2, area3)
t = int(input())
for i in range(t):
	arr = list(map(int, input().strip().split()))[:4]
	print(solve(arr))


n = int(input())
for i in range(n):
	a = input().split()
	b = []
	for i in a:
		b.append(int(i))
	b.sort()
	print(b[0] * b[2])


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from itertools import permutations
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in st()]

def givearea(a, b, c, d):
	return min(a, b) * min(c, d)
for _ in range(val()):
	ans = 0
	(a, b, c, d) = li()
	for (a, b, c, d) in list(permutations([a, b, c, d])):
		ans = max(ans, givearea(a, b, c, d))
	print(ans)


for t in range(int(input())):
	a = sorted(list(map(int, input().split())))
	print(a[0] * a[2])


for i in range(int(input())):
	l = [int(x) for x in input().split()]
	l.sort()
	print(l[0] * l[2])


for i in range(int(input())):
	l = sorted(list(map(int, input().split())))
	print(l[0] * l[2])


for tests in range(int(input())):
	a = [int(s) for s in input().split()]
	A1 = min(a[0], a[1]) * min(a[2], a[3])
	A2 = min(a[0], a[2]) * min(a[1], a[3])
	A3 = min(a[0], a[3]) * min(a[1], a[2])
	print(max(A1, A2, A3))


import sys
input = sys.stdin.readline
inputLines = sys.stdin.readlines

def readIntList():
	return list(map(int, input().split()))

def readStrList():
	return list(map(lambda x: x.strip(), inputLines()))

def indexOf(l: list, elem):
	return l.index(elem) if elem in l else -1

def lastIndexOf(l: list, elem):
	indexes = [idx for (idx, val) in enumerate(l) if val == elem]
	return max(indexes) if len(indexes) > 0 else -1

def solution():
	for _ in range(int(input())):
		l = readIntList()
		l.sort()
		print(l[0] * l[2])
solution()


import math

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = int(input())
k = 0
while k != t:
	(a, b, c, d) = inlt()
	lati = [a, b, c, d]
	lati.sort()
	a = lati[0]
	b = lati[1]
	c = lati[2]
	d = lati[3]
	if a != b and c != d:
		x = c * a
	elif a == b and c != d:
		x = c * a
	elif c == d and a != b:
		x = a * c
	elif a == b and c == d:
		x = a * c
	elif b == c:
		x = a * b
	print(x)
	k = k + 1


t = int(input())
answers = []
for i in range(t):
	arr = []
	arr.append(input().split())
	arr2 = []
	for i in range(len(arr[0])):
		arr2.append(int(arr[0][i]))
	arr2.sort(reverse=True)
	max_area = arr2[1] * arr2[3]
	answers.append(max_area)
for i in answers:
	print(i)


t = int(input())
for i in range(t):
	a = list(map(int, input().split(' ')))
	s = min(a)
	a.remove(s)
	ss = min(a)
	a.remove(ss)
	ts = min(a)
	print(ts * s)


ans = []

def solve(arr):
	arr = sorted(arr, key=lambda x: x)
	return arr[0] * arr[2]
k = int(input())
arr = []
for i in range(k):
	arr.append([int(x) for x in input().split()])
for i in range(len(arr)):
	print(solve(arr[i]))


t = int(input())
for o in range(t):
	a = list(map(int, input().split()))
	b = sorted(a)
	p = min(b[0], b[1])
	q = min(b[2], b[3])
	print(p * q)


N = int(input())
for n in range(N):
	len_list = [int(i) for i in input().split(' ')]
	len_list.sort()
	print(len_list[0] * len_list[2])


import os
import math
import statistics
true = True
false = False
from functools import reduce
is_dev = 'vscode' in os.environ
if is_dev:
	inF = open('in.txt', 'r')
	outF = open('out.txt', 'w')

def ins():
	return list(map(int, input_().split(' ')))

def inss():
	return list(input_().split(' '))

def input_():
	if is_dev:
		return inF.readline()[:-1]
	else:
		return input()

def ranin():
	return range(int(input_()))

def print_(data):
	if is_dev:
		outF.write(str(data) + '\n')
	else:
		print(data)
epsilon = 1e-07
for _ in range(int(input_())):
	(a, b, c, d) = sorted(ins())
	print_(f'{min(a, b) * min(c, d)}')
if is_dev:
	outF.close()

	def compare_file():
		print(open('out.txt', 'r').read() == open('outactual.txt', 'r').read())
	compare_file()


for i in range(int(input())):
	a = sorted([int(a) for a in input().split()])
	print(a[0] * a[2])


for i in range(int(input())):
	seg = [int(x) for x in input().split(' ')]
	seg.sort()
	base = seg[0]
	height = seg[-2]
	print(base * height)


from sys import stdin
tt = int(stdin.readline())
for loop in range(tt):
	(a, b, c, d) = map(int, stdin.readline().split())
	print(max(min(a, b) * min(c, d), min(a, c) * min(b, d), min(a, d) * min(b, c)))


n = int(input())
t = []
for i in range(n):
	x = list(map(int, input().split()))
	x.sort()
	t.append(x)
for j in t:
	print(j[0] * j[2])


t = int(input())
for i in range(t):
	lst = list(map(int, input().strip().split()))[:4]
	new = sorted(lst)
	print(new[0] * new[2])


for _ in range(int(input())):
	a = sorted(list(map(int, input().split())))
	print(min(a[0], a[1]) * min(a[2], a[3]))


import math
import sys

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

def solve():
	a = Read.list_int()
	a = sorted(a)
	print(a[0] * a[2])
	return
	n = Read.int()
	a = {}
	b = {}
	for i in range(n):
		(x, y, u, v) = Read.list_int()
		k1 = abs(x - u)
		k2 = abs(y - v)
		t = '0.0' if k2 == 0 else k1 / k2
		t = str(t)
		if x > u and y > v or (x < u and y < v):
			t += '_'
		elif x == u or y == v:
			t += '1'
		use_a = 1
		if y > v:
			use_a = 1
		elif v < y:
			use_a = 0
		else:
			use_a = 1 if x > u else 0
		if use_a == 1:
			if t in a:
				a[t] += 1
			else:
				a[t] = 1
		elif t in b:
			b[t] += 1
		else:
			b[t] = 1
	res = 0
	for (k, t) in a.items():
		if k in b:
			res += t * b[k]
	print(res)
query_count = Read.int()
while query_count:
	query_count -= 1
	solve()


t = int(input())
for i in range(0, t):
	l = list(map(int, input().split()))
	l.sort()
	if len(l) == 4:
		print(l[0] * l[2])


def fun(ls):
	ls = sorted(ls)
	print(ls[0] * ls[2])
T = int(input())
for i in range(T):
	ls = list(map(int, input().split()))
	fun(ls)


qc = int(input())
for qq in range(qc):
	t = list(map(int, input().split()))
	t.sort()
	print(t[0] * t[2])


import math
from collections import defaultdict
from sys import stdin
input = stdin.readline
T = int(input())
for _ in range(T):
	a = list(map(int, input().split()))
	a.sort()
	print(a[0] * a[2])


t = int(input())
test = []
for i in range(t):
	x = input().split()
	test.append(x)
i = 0
for i in range(t):
	a = sorted(list(map(int, test[i])))
	print(a[0] * a[2])


import sys
import math
import collections
import bisect
import string

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
for t in range(int(input())):
	arr = get_list()
	arr.sort()
	print(arr[0] * arr[2])


import sys, io, os, math
from math import ceil, log, gcd, inf
from itertools import permutations
mod = 1000000007

def printlist(n):
	sys.stdout.write(' '.join(map(str, n)) + '\n')
printf = lambda n: sys.stdout.write(str(n) + '\n')

def printns(n):
	sys.stdout.write(str(n))

def intinp():
	return int(sys.stdin.readline())

def strinp():
	return sys.stdin.readline()

def arrinp():
	return list(map(int, sys.stdin.readline().strip().split()))

def mulinp():
	return map(int, sys.stdin.readline().strip().split())

def flush():
	return sys.stdout.flush()

def power_two(x):
	return 1 << x

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	a = arrinp()
	a.sort()
	print(a[0] * a[2], end='\n')
	return

def main():
	tc = intinp()
	while tc:
		solve()
		tc -= 1
main()


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	print(max(min(a, b) * min(c, d), min(a, c) * min(b, d), min(a, d) * min(b, c)))


import bisect
import math

def solve(arr):
	arr.sort()
	return arr[0] * arr[2]
t = int(input())
ans = []
for i in range(t):
	arr = [int(x) for x in input().split()]
	ans.append(solve(arr))
for test in ans:
	print(test)


N_Veces = int(input())
for i in range(0, N_Veces):
	Segmentos = input().split()
	for i in range(0, len(Segmentos)):
		Segmentos[i] = int(Segmentos[i])
	Segmentos.sort()
	print(Segmentos[0] * Segmentos[2])


import math
k = 1
alfabet = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26}
while k > 0:
	n = int(input())
	for j in range(0, n):
		lista = list(map(int, input().split()))
		lista.sort()
		rasp = min(lista[3], lista[2]) * lista[0]
		print(rasp)
	k = k - 1


t = int(input())
for j in range(t):
	arr = list(map(int, input().split()))
	arr.sort()
	print(min(arr[0], arr[1]) * min(arr[2], arr[3]))


import math
tt = int(input())
for i in range(tt):
	list1 = list(map(int, input().split()))[:4]
	list1.sort()
	ans = list1[0] * list1[2]
	print(ans)


t = int(input())

def solve(segments):
	segments = sorted(segments)
	return segments[0] * segments[2]
while t > 0:
	segments = [int(i) for i in input().split()]
	print(solve(segments))
	t -= 1


t = int(input())
cases = []
while t > 0:
	cases.append([int(x) for x in input().split(' ')])
	t -= 1
for case in cases:
	case.sort()
	print(min(case[0], case[1]) * min(case[2], case[3]))


T = int(input())
for i in range(T):
	arr = [int(x) for x in input().split()]
	arr.sort()
	print(arr[0] * arr[2])


a = int(input())
for x in range(a):
	b = list(map(int, input().split()))
	b.sort(reverse=True)
	print(b[1] * b[3])


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	A = list(map(int, input().split()))
	A.sort()
	print(A[0] * A[2])