import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[])throws IOException {
// Your Code Here
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(br.readLine());
String arr[]=br.readLine().split(" ");
String brr[]=br.readLine().split(" ");
HashMap<Long,Long> s=new HashMap<>();
for(int i=0;i<n;i++){
long x=Long.parseLong(arr[i]);
if(s.containsKey(x)){
s.replace(x,s.get(x)+1);
}
else s.put(x,1L);
}
// SortedSet<Integer> r=new TreeSet<>();
List<Long> res=new ArrayList<>();
for(int i=0;i<n;i++){
long x=Long.parseLong(brr[i]);
if(s.containsKey(x) && s.get(x)>0){
res.add(x);
s.replace(x,s.get(x)-1);
}
}
Collections.sort(res);
System.out.println(res);
}
}
