import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    n = int(input())
    al = [int(input()) for i in range(n)]

    for i in range(n):
        print(max(al[:i] + al[i+1:]))
