def reverse_linked_list(head, max_node_count):
    """
    Reverse linked list but only up to max_node_count.
    Return the new head and tail of the linked list.
    """
    if not head:
        return None, None, None

    count = 1
    first_node = head
    second_node = head.next
    head.next = None  # Make sure list has no cycle

    while second_node and count < max_node_count:
        third_node = second_node.next
        second_node.next = first_node

        first_node = second_node
        second_node = third_node

        count += 1

    rest = second_node
    tail = head  # Old head is the new tail
    head = first_node  # Head is now the last node

    return head, tail, rest