def main():
    n = int(input())
    a = [int(input()) for _ in range(n)]
    for i in range(n):
        ans = -1
        for j in range(n):
            if i == j: continue
            ans = max(ans, a[j])
        print(ans)

main()