n = int(input())
an = []
for i in range(n):
    an.append(int(input()))

import numpy as np
an = np.array(an)
for i in range(n):
	ind = np.ones(n, dtype=bool)
	ind[i] = False
	res = np.max(an[ind])
	print(res)