
def main():
    N = int(input())
    A_list = [int(input()) for _ in range(N)]
    for i in range(N):
        tmp = A_list.pop(i)
        print(max(A_list))
        A_list.insert(i, tmp)


if __name__ == '__main__':
    main()