sequence = []

N = int(input())

for i in range(N):
    sequence.append(int(input()))

# print('sequence', sequence)

for i in range(N):
    temp = sequence[:]
    temp.pop(i)
    # print('temp', temp)
    print(max(temp))
