#include using namespace std; int N, M; int x[1000]; int y[1000]; int a[10000]; int b[10000]; int cnt[10000]; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> N; for(int i=0; i> a[i] >> b[i]; } cin >> M; for(int i=0; i> x[i] >> y[i]; } int maxC = 0; for(int m=0; m=b[n]) { cnt[m]++; } } maxC = cnt[m]>maxC ? cnt[m] : maxC; } if(maxC == 0) { cout << 0 << endl; return 0; } for(int i=0; i