import numpy as np
def main():
    N = int(input())
    A = []
    for i in range(N):
        A.append(int(input()))

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


if __name__ == "__main__":
    main()
