def main(n: int, a: list):
    ans = 0
    for i in range(n):
        t = a.copy()
        t[i] = 0

        print(max(t))


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

    main(n, a)
