def ehand(n,a):
    for i in range(n):
        print max(a[:i]+a[(i+1):])
 
if __name__ == '__main__':
    n = int(raw_input())
    a = []
    a = [raw_input() for i in range(n)]
 
    ehand(n,map(int,a))