#include #include #include #include #include #include #include #include #include #include #include #define FOR(i, a, b) for (i = a; i < b; ++i) #define rep(N) for (int i = 0; i < N; ++i) #define For(i, N) for (i = 0; i < N; ++i) #define rev(N) for (int i = N - 1; i >= 0; --i) #define all(v) v.begin(), v.end() #define make(N) int N; cin >> N; #define mod 1000000007 #define re return 0 using namespace std; using ll = long long int; using vi = vector; using vvi = vector>; using vll = vector; using vb = vector; using vvb = vector>; using vs = vector; using pii = pair; using pis = pair; template void say(T s) { cout << s << endl; } template void say(vector s) { auto itr = s.begin(); cout << *(itr++); while (itr != s.end()) { cout << " " << *(itr++); } cout << endl; } bool comp(pii x, pii y) { if (x.first != y.first)return x.first > y.first; else return x.second < y.second; } int main() { make(N); vi A(N), B(N); rep(N) cin >> A[i] >> B[i]; make(M); vector point; rep(M)point.push_back({ 0,i + 1 }); int p; For(p, M) { make(X); make(Y); rep(N) if (X <= A[i] && B[i] <= Y)++point[p].first; } sort(all(point), comp); if (point[0].first == 0) say(0); else { int Max = point[0].first; int i = 0; while (point[i].first == Max)say(point[i++].second); } }