N = int(input())
nums = [input() for i in range(N)]

max_list = []
for i in range(0, N):
    f_nums = nums[:i]
    l_nums = nums[i+1:]
    f_nums.extend(l_nums)
    _max = max(f_nums)
    max_list.append(_max)

for x in max_list:
    print(x)
    


