N =	 int(input())
L1 = list(map(int,input().split()))
L2 = list(map(int,input().split()))
L3 = list(map(int,input().split()))

L1.remove(N)

ML1 = max(L1)
print(ML1)
L3.pop(ML1-1)

SL2 = sum(L2)
SL3 = sum(L3)


print(SL2 + SL3)