#     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
        nodes=set()
        while pHead1 is not None:
            
            nodes.add(pHead1)
            pHead1=pHead1.next
        while pHead2 is not None:
            if pHead2 not in nodes:
                pHead2=pHead2.next
            else:
                
                return pHead2
        return None
                
##### 利用希哈表来存储pHead1的所有节点,在遍历pHead2的节点,判断pHead2的节点是否在希哈表中,
在的时候就是第一个公共节点,return 该节点即可。