import java.util.;
import java.io.;
public class Main {
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String s1[] = br.readLine().trim().split("\s+");
String s2[] = br.readLine().trim().split("\s+");
HashMap<String, Integer> map = new HashMap<>();
ArrayList<String> list = new ArrayList<>();
for(int i = 0; i < n; i++) {
if(map.containsKey(s1[i])) {
map.put(s1[i], map.get(s1[i]) + 1);
} else {
map.put(s1[i], 1);
}
}
for(int i = 0; i < n; i++) {
if(map.containsKey(s2[i])) {
if(map.get(s2[i]) > 0) {
list.add(s2[i]);
map.put(s2[i], map.get(s2[i]) - 1);
}
}
}
Collections.sort(list);
System.out.print(list);
}
}