n=int(input()) number=list(map(int,input().split(' '))) number.sort(reverse=True) for i in range(5): print(number[i],end=" ")
n=int(input()) number=list(map(int,input().split(' '))) number.sort(reverse=True) for i in range(5): print(number[i],end=" ")