def main():
    N = int(input())
    A = [int(input()) for i in range(N)]

    for j in range(N):
        ans = [x for i, x in enumerate(A) if i != j]
        print(max(ans))


if __name__ == "__main__":
    main()
