class Solution:
def mergeTwoLists(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
if l1==None:
return l2
if l2 == None:
return l1
result = ListNode(0)
l=result
while 1:
if l1.val <= l2.val:
l.next = l1
l1=l1.next
if l1==None:
break
else:
l.next=l2
l2=l2.next
if l2 == None:
break
l=l.next
l.next.next=l1 or l2
return result.next