import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    
    d = {}
    [d.update({i:int(input())}) for i in range(N)]
    
    for i in range(N):
        d2 = d.copy()
        d2.pop(i)
        print(max(d2.values()))
    
    
if __name__ == '__main__':
    main()