#coding : utf-8

import os
import sys

def except_i(a, i):
	return a[0:i] + a[i+1:len(a)]

N = int(input())

A = []

for i in range(N):
	A.append(int(input()))


for i in range(N):
	print(max(except_i(A, i)))

