#include #define rep(i,n) for(int i=0;i<(int)(n);i++) using namespace std; using ll = long long ; using P = pair ; using pll = pair; constexpr int INF = 1e9; constexpr long long LINF = 1e17; constexpr int MOD = 1000000007; int main(){ int n; cin >> n; vector

ab(n); rep(i,n) cin >> ab[i].first >> ab[i].second; int m; cin >> m; vector

xy(m); rep(i,m) cin >> xy[i].first >> xy[i].second; vector cnt(m); rep(i,n)rep(j,m){ if(xy[j].first <= ab[i].first && ab[i].second <= xy[j].second){ cnt[j] ++; } } int mx = 0; vector idx; rep(i,m){ if(cnt[i]==0) continue; if(cnt[i] > mx){ mx = cnt[i]; idx = {i}; }else if(cnt[i]==mx){ idx.push_back(i); } } if(idx.size()==0) cout << 0 << endl; else{ rep(i,idx.size()){ cout << idx[i]+1 << endl; } } return 0; }