def solve():
    n = int(input())
    a = list(int(input()) for _ in range(n))
    for idx in range(n):
        d = max([v for i, v in enumerate(a) if i != idx])
        print(d)


if __name__ == "__main__":
    solve()
