def test():
    n = int(input())
    a = [int(input()) for i in range(n)]
    s = 0
    for i in range(n):
        s = a[i]
        a[i] = 0
        print(max(a))
        a[i] = s


if __name__ == "__main__":
    test()
