java
List<Integer> list1 = Arrays.asList(1,2,3,4,5);
List<Integer> list2 = Arrays.asList(3,4,5);
List<Integer> list3 = Arrays.asList(3,4,5,6);
List<Integer> list4 = Arrays.asList(6,7,8);
if (list1.stream().anyMatch(list2::contains)) {
System.out.println("1");
}
if (list1.stream().anyMatch(list3::contains)) {
System.out.println("2");
}
if (list1.stream().anyMatch(list4::contains)) {
System.out.println("3");
}