Netskope SSE pipelines may process events as a singly linked list. Given the head of such a list, split it into two lists based on the nodes' 1-based positions: the first output contains positions 1, 3, 5, and so on, while the second contains positions 2, 4, 6, and so on.
Rewire the existing nodes instead of creating replacement nodes. Return the two head nodes as (odd_head, even_head). The relative order of nodes in each output list must be preserved.
A ListNode is provided with fields val and next. For test cases, linked lists are represented as Python arrays, and outputs are represented as a pair of arrays.
def split_odd_even(head):