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 = []
    for y in A:
        t.append(y)
    # print(t)
    t.remove(A[x])
    print(max(t))
