#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve(){
int n; cin >>n;
map <string,vector <int>> si;
map <int,string> is;
for(int i=0; i<n; i++){
string s;
cin >>s;
if(si[s].size()==0) si[s].push_back(0);
si[s].push_back(i);
si[s][0]++;
is[i]=s;
}
vector <bool> check(n, true);
for(int i=0; i<n-1; i++){
string s;
cin >>s;
int k = si[s][si[s][0]];
si[s][0]--;
check[k]=false;
}
for(int i=0; i<n; i++){
if(check[i]) cout <<is[i];
}
}
signed main(){
int t=1;// cin >>t;
while(t--){
solve();
}
return 0;
}