def maximum(l,ind):
	max=-90000000
	for i in range(0,len(l)):
		if(i!=ind):
			if(l[i]>max):
				max=l[i]
	return max
n=int(input())
l=[]
for i in range(0,n):
	l.append(int(input()))
for i in range(0,n):
	print(maximum(l,i))