#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin>>a[i];
  int m;
  cin>>m;
  vector<int> b(m);
  for(int i=0;i<m;i++) cin>>b[i];

  vector<int> c;
  set_intersection(a.begin(),a.end(),b.begin(),b.end(),back_inserter(c));
  for(int x:c) cout<<x<<endl;
  return 0;
}

