#include #include #include #include #define rep(i, a, n) for(int i = a;i < n;i++) #define repe(i, a, n) for(int i = a;i <= n;i++) #define repr(i, a, n) for(int i = a;i > n;i--) using namespace std; int n, m; int a[10010], b[10100]; int x[1010], y[1010]; pair vote[1010]; void solve(){ repe(i, 1, m) vote[i].second = i; repe(i, 1, n) repe(j, 1, m) if(x[j] <= a[i] && b[i] <= y[j]) vote[j].first++; sort(&vote[1], &vote[m+1]); vector men; if(!vote[m].first){ cout << 0 << endl; return; } men.push_back(vote[m].second); repr(i, m-1, 0){ if(vote[i].first != vote[i+1].first) break; men.push_back(vote[i].second); } sort(men.begin(), men.end()); for(auto i : men) cout << i << endl; } int main(){ cin >> n; repe(i, 1, n) cin >> a[i] >> b[i]; cin >> m; repe(i, 1, m) cin >> x[i] >> y[i]; solve(); return 0; }