class Solution(object):
def insertionSortList(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
res = p = ListNode(0)
res.next = head
cur = head
while cur and cur.next:
val = cur.next.val
if val > cur.val:
cur = cur.next
continue
if p.next.val > val:
p = res
while p.next.val < val:
p = p.next
new = cur.next
cur.next = new.next
new.next = p.next
p.next = new
return res.next