import sys
import copy
def input():
	return sys.stdin.readline().rstrip()
def main():
	N = int(input())
	A = [int(input()) for _ in range(N)]
	for i in range(N):
		B = copy.deepcopy(A)
		B.pop(i)
		print(max(B))
if __name__ == '__main__':
	main()