C = int(input())
N, M, L = zip(*(map(int, input().split()) for _ in range(C)))

max_n = 0
max_m = 0
max_l = 0
for i in range(C):
    n, m, l = sorted([N[i], M[i], L[i]])
    max_n = max(max_n, n)
    max_m = max(max_m, m)
    max_l = max(max_l, l)

ans = max_n * max_m * max_l

print(ans)
