import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n1 = sc.nextInt();
        // If n1 or n2 negative → No common elements
        if (n1 < 0) {
            System.out.println("No common elements");
            return;
        }

        Set<Integer> set1 = new HashSet<>();
        for (int i = 0; i < n1; i++) {
            set1.add(sc.nextInt());
        }

        int n2 = sc.nextInt();
        if (n2 < 0) {
            System.out.println("No common elements");
            return;
        }

        Set<Integer> set2 = new HashSet<>();
        for (int i = 0; i < n2; i++) {
            set2.add(sc.nextInt());
        }

        // Find intersection
        Set<Integer> intersection = new TreeSet<>(set1);
        intersection.retainAll(set2);

        if (intersection.isEmpty()) {
            System.out.println("No common elements");
        } else {
            for (int num : intersection) {
                System.out.print(num + " ");
            }
        }
    }
}
