n = int(input()) l = [] for i in range(5): l.append(input()) l.sort(key=lambda x:len(x)) print(l[-n])