public class ListNode {
public int val;
public ListNode next = null;
public ListNode(){
}
public ListNode(int val) {
this.val = val;
}
public void addListNode(ListNode nextNode){
this.next = nextNode;
}
@Override
public String toString(){
System.out.println(val);
System.out.println("das");
// while(next != null){
// System.out.println(next.val);
// next = next.next;
// }
return "" + val;
}
}
public class No52FirstCommonNodesInLists {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int m = scanner.nextInt();
int n = scanner.nextInt();
if (m<1 || n<1){
return ;
}
int num1 = scanner.nextInt();
ListNode list1 = new ListNode(num1)