X = int(input())
Y = list(map(int, input().split()))
Z = min(Y)
Y.remove(Z)
F = min(Y)
print(F)

22a19c541985bc4547f4d029d7404aef46e5657d
<mask token>

<mask token>
Y.remove(Z)
<mask token>
print(F)

X = int(input())
Y = list(map(int, input().split()))
Z = min(Y)
Y.remove(Z)
F = min(Y)
print(F)
