i = input()
N = int(i)
A = []
for x in range(N):
    j = input()
    A.append(int(j))

for x in range(N):
    #print(x)
    t = []
    if x != N - 1:
        t = A[:x] + A[x+1:]
    else:
        t = A[:x]
    print(max(t))
