def main():
    N = int(input())
    A = []
    for i in range(N):
        A.append(int(input()))
    
    for i in range(N):
        tmp,A[i] = A[i],0
        print(max(A))
        A[i] = tmp


if __name__=="__main__":
    main()