import copy

n = int(input())

a = [0] * n

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

# a_s = set(a)

for i in range(n):
    tmp = copy.deepcopy(a)
    # tmp.discard(a[i])
    del tmp[i]
    print(max(tmp))
