# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
#
#
# @param pHead1 ListNode类
# @param pHead2 ListNode类
# @return ListNode类
#
class Solution:
def FindFirstCommonNode(self , pHead1 , pHead2 ):
# write code here
first = pHead1
second = pHead2
if first == None or second == None: return None
while first != second:
if first:
first = first.next
else:
first = pHead2
if second:
second = second.next
else:
second = pHead1
return second