class Solution:
# @param {ListNode} l1
# @param {ListNode} l2
# @return {ListNode}
def mergeTwoLists(self, l1, l2):
head=ListNode(0)
temp = head
if l1 == None: return l2
if l2 == None: return l1
while l1 and l2:
if l1.val>l2.val:
temp.next = l2; l2 = l2.next; temp = temp.next
else:
temp.next = l1; l1 = l1.next; temp = temp.next
if l1 == None: temp.next = l2
if l2 == None: temp.next = l1
return head.next