#include <bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
using namespace std;

int main()
{
    int n,m;
    cin>>n;
    vector<int>a(n);
    REP(i,n)cin>>a[i];
    cin>>m;
    vector<int>b(m);
    REP(i,m)cin>>b[i];
    vector<int>c;
    set_intersection(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
    for(auto i:c)cout<<i<<endl;
}

