# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution(object):
def mergeTwoLists(self, l1, l2):
if l1==None and l2==None:
return None
fackNode=ListNode(0)
head=fackNode
while l1!=None or l2!=None:
if l1==None:
head.next=l2
l2=l2.next
head=head.next
elif l2==None:
head.next=l1
l1=l1.next
head=head.next
else:
if l1.val<=l2.val:
head.next=l1
l1=l1.next
head=head.next
else:
head.next=l2
l2=l2.next
head=head.next
return fackNode.next