/*import java.util.*;

public class ScrollIntersection {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
            int n1 = scanner.nextInt();
            scanner.nextLine(); 

            Set<Integer> set1 = new HashSet<>();
            String[] elements1 = scanner.nextLine().split(" ");
            for (String s : elements1) {
                if (!s.isEmpty()) {
                    set1.add(Integer.parseInt(s));
                }
            }
            int n2 = scanner.nextInt();
            scanner.nextLine(); 

            Set<Integer> set2 = new HashSet<>();
            String[] elements2 = scanner.nextLine().split(" ");
            for (String s : elements2) {
                if (!s.isEmpty()) {
                    set2.add(Integer.parseInt(s));
                }
            }
            set1.retainAll(set2);

            List<Integer> intersectionList = new ArrayList<>(set1);
            Collections.sort(intersectionList);

            if (intersectionList.isEmpty()) {
                System.out.println("No common elements");
            } else {
                for (int i = 0; i < intersectionList.size(); i++) {
                    System.out.print(intersectionList.get(i) + (i == intersectionList.size() - 1 ? "" : " "));
                }
                System.out.println();
            }

    }
}*/
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        int n1=sc.nextInt();
        Set<Integer> set1=new TreeSet<>();
        for(int i=0;i<n1;i++){
            set1.add(sc.nextInt());
        }
        int n2=sc.nextInt();
        Set<Integer> set2=new TreeSet<>();
        for(int j=0;j<n2;j++){
            set2.add(sc.nextInt());
        }
        
    }
}