#include<bits/stdc++.h>
using namespace std;
using ll = long long;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

int main(){
    ll N;
    cin >> N;
    set<ll> A;
    while(N--){
        ll a; cin >> a;
        A.insert(a);
    }

    ll M;
    cin >> M;
    set<ll> B;
    while(M--){
        ll b; cin >> b;
        B.insert(b);
    }

    vector<ll> C;
    set_intersection(ALL(A), ALL(B), back_inserter(C));

    for(ll c : C){
        p(c);
    }

    return 0;
}
