t = eval(input())

lst = list(map(int, input().split()))

a = max(lst)

b = min(lst)

c = sum(lst)

print((str(b) + " " + str(a) + " " + str(c)))
t = int(eval(input()))

lst = list(map(int, input().split()))

a = min(lst)

b = max(lst)

c = sum(lst)

print((str(a) + " " + str(b) + " " + str(c)))
t = eval(input())
lst = list(map(int, input().split()))
a = max(lst)
b = min(lst)
c = sum(lst)
print((str(b) + " " + str(a) + " " + str(c)))

t = int(eval(input()))
lst = list(map(int, input().split()))
a = min(lst)
b = max(lst)
c = sum(lst)
print((str(a) + " " + str(b) + " " + str(c)))

-t = eval(input()) +t = int(eval(input())) -a = max(lst) -b = min(lst) +a = min(lst) +b = max(lst) -print((str(b) + " " + str(a) + " " + str(c))) +print((str(a) + " " + str(b) + " " + str(c)))