import copy
def main():
    N = int(input())
    A = [int(input()) for a in range(N) ]
    for i in range(N):
        tmp = copy.copy(A[i])
        A[i] = 0
        print(max(A))
        A[i] = copy.copy(tmp)
if __name__ == "__main__":
    main()