import copy

n = int(input().split()[0])
a_list = []

for _ in range(n):
    a_list.append(int(input().split()[0]))

max_str = ''

for i, a in enumerate(a_list):
    kouho_list = copy.copy(a_list)
    kouho_list.pop(i)
    max_str += '{}\n'.format(max(kouho_list))

print(max_str[:-1])
