import sys
import copy
import math
import itertools
import numpy as np
N = int(input())
A = [int(input()) for c in range(N)]

for i in range(N):
    max = 0
    for j in range(N):
        if j!=i:
            if max<A[j]:
                max = A[j]
    print(max)