//editor 2

import java.util.*;

public class NumberSorter {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        if (n < 0 || n>100) {
            System.out.println("Invalid input");
            return;
        }

        ArrayList<Integer> list1 = new ArrayList<>();
        for (int i = 0; i < n; i++){
            int n = sc.nextInt();
            if(n<100 || n>100) continue;
            list1.add(n);
        
        }
        int m = sc.nextInt();
        if (m < 0 || m>100) {
            System.out.println("Invalid input");
            return;
        }
        
        ArrayList<Integer> list2 = new ArrayList<>();
        for (int i = 0; i < m; i++){
            int n = sc.nextInt();
            if(n<100 || n>100) continue;
            list1.add(n);
        
        }

        ArrayList<Integer> intersection = new ArrayList<>(list1);
        intersection.retainAll(list2);
        if(!intersection.isEmpty()){
            for(int num : intersection){
                System.out.print(num+" ");
            }
        }
        else{
            System.out.println("No common elements");
        }
    }
}