import numpy as np


def main():
	#N, D = [int(x) for x in input().split()]
	N = int(input())
	
	lst = []
	for i in range(N):
		lst.append(int(input()))

	a = np.array(lst)
	
	for i in range(N):
		mask = [True] * N
		mask[i] = False
		mask = np.array(mask)
		_a = a[mask]
		print(np.max(_a))

if __name__ == "__main__":
	main()
