import sys
input = sys.stdin.readline

n = int(input())
numbers = [int(input()) for i in range(n)]

for i in range(n):
    temporary_list = list(numbers)
    temporary_list.pop(i)
    print(max(temporary_list))