/*
public class ListNode {
    int val;
    ListNode next = null;

    ListNode(int val) {
        this.val = val;
    }
}*/
public class Solution {
    public ListNode FindFirstCommonNode(ListNode pHead1, ListNode pHead2) {

        while(pHead1 != null){
            ListNode node = pHead2;
            while(node != null){
                if(pHead1 == node){
                    return node;
                } else {
                    node = node.next;
                }
            }
            pHead1 = pHead1.next;
         }
        return null;
    }
}