#include using namespace std; int main(){ ios_base::sync_with_stdio(false); int n; cin>>n; vector topico(n); map topico_da_palavra; for(int i=0; i>topico[i]; int k; cin>>k; while(k--){ string palavra; cin>>palavra; topico_da_palavra[palavra] = i; } } vector relacionadas(n); int x; cin>>x; int maximo = 0; string resposta = ""; while(x--){ string p; cin>>p; if(!topico_da_palavra.count(p)) continue; int t = topico_da_palavra[p]; relacionadas[t]++; if(relacionadas[t] > maximo){ maximo = relacionadas[t]; resposta = topico[t]; } else if(relacionadas[t] == maximo && topico[t] < resposta){ resposta = topico[t]; } } cout<