#include using namespace std; typedef long long ll; #define REP(i,n) for(int i=0; i #define VLL vector #define VVI vector> #define VVLL vector> #define VC vector #define VS vector #define VVC vector> #define fore(i,a) for(auto &i:a) typedef pair P; template bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } const int INF = 2147483647; const ll INFL = 9223372036854775807; const ll mod = 1000000007; int main() { int n, m; cin >> n; VI a(n), b(n); REP(i, n)cin >> a[i] >> b[i]; cin >> m; VI c(m, 0); REP(i, m) { int x, y; cin >> x >> y; REP(j, n) { if (x <= a[j] && b[j] <= y)c[i]++; } } VI v; int tmp = 0; REP(i, m) { if (c[i] == tmp)v.push_back(i + 1); else if (c[i] >= tmp) { tmp = c[i]; v = {}; v.push_back(i + 1); } } if (tmp == 0) { cout << 0 << endl; return 0; } REP(i, v.size()) { cout << v[i] << endl; } return 0; }