# def s(i) :
# 	p = data
# 	p[i] = 0
# 	p.sort()
# 	print(p[-1])


n = int(input())
data = [int(input()) for k in range(n)]
for i in range(n):
	data2 = data[:]
	data2[i] = 0
	data2.sort()
	print(data2[-1])
	# s = data
	# s[i] = 0
	# s.sort()
	# print(s[-1])
	# print(s)