class Solution:
    def middleNode(self, head: ListNode) -> ListNode:
        fast_pointer = head
        slow_pointer = head
        while(fast_pointer):
            if fast_pointer.next is None:
                return slow_pointer
            if fast_pointer.next.next is None:
                return slow_pointer.next
            fast_pointer = fast_pointer.next.next
            slow_pointer = slow_pointer.next

161d788f3cd7817417b347af95d4e66156dd1072
<mask token>

class Solution:
    <mask token>

class Solution:

    def middleNode(self, head: ListNode) ->ListNode:
        fast_pointer = head
        slow_pointer = head
        while fast_pointer:
            if fast_pointer.next is None:
                return slow_pointer
            if fast_pointer.next.next is None:
                return slow_pointer.next
            fast_pointer = fast_pointer.next.next
            slow_pointer = slow_pointer.next

class Solution:
    def middleNode(self, head: ListNode) -> ListNode:
        fast_pointer = head
        slow_pointer = head
        while(fast_pointer):
            if fast_pointer.next is None:
                return slow_pointer
            if fast_pointer.next.next is None:
                return slow_pointer.next
            fast_pointer = fast_pointer.next.next
            slow_pointer = slow_pointer.next
