def main():
    N = int(input())

    A = [int(input()) for _ in range(N)]

    for i in range(len(A)):
        tmp = A[i]
        A[i] = 0
        print(max(A))
        A[i] = tmp

if __name__ == '__main__':
    main()
