import math

def main(): 

    n = int(input())
    a = [int(input()) for _ in range(n)]

    for i in range(n):
        t = list(a)
        t.pop(i)

        print(max(t))




if __name__ == "__main__":
    main() 