#include <iostream>
#include <set>
#define int long long
using namespace std;
set<int>s, t;
int n, p;
signed main() {
	cin >> n; for (int i = 0; i < n; i++) { cin >> p; s.insert(p); }
	cin >> n; for (int i = 0; i < n; i++) { cin >> p; if (s.count(p))t.insert(p); }
	for (int i : t)cout << i << endl;
}
