#include <bits/stdc++.h>

using namespace std;

#define reps(i, n, m) for (int i = (int) (n); i < (int) (m); i++)
#define rep(i, n) reps(i, 0, (n))
#define all(v) (v).begin(), (v).end()

int main() {
    set<int> a, b, c;
    int n; cin >> n;
    while (n--) {
        int x; cin >> x; a.insert(x);
    }
    int m; cin >> m;
    while (m--) {
        int x; cin >> x; b.insert(x);
    }
    set_intersection(all(a), all(b), inserter(c, c.begin()));
    for (auto& x : c) {
        cout << x << endl;
    }
}
