t = int(input()) for _ in range(t): n = int(input()) a = list(map(int, input().split())) if 0 in a: print(0) continue pos = sorted([x for x in a if x > 0]) neg = sorted([x for x in a if x < 0]) if neg == []: print(pos[0] * pos[1]) continue if pos == []: print(neg[-1] * neg[-2]) continue cand1 = neg[-1] * pos[0] cand2 = neg[0] * pos[-1] print(max(cand1, cand2))