#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const long long MAX = 5100000; const long long INF = 1LL << 60; const long long mod = 1000000007LL; //const long long mod = 998244353LL; using namespace std; typedef unsigned long long ull; typedef long long ll; int main() { /* cin.tie(nullptr); ios::sync_with_stdio(false); */ ll n; scanf("%lld", &n); vector a(n), b(n); for (ll i = 0; i < n; i++) scanf("%lld %lld", &a[i], &b[i]); ll m; scanf("%lld", &m); vector> cnt(m); for (ll i = 0; i < m; i++) cnt[i].second = i + 1; for (ll i = 0; i < m; i++) { ll x, y; scanf("%lld %lld", &x, &y); for (ll j = 0; j < n; j++) { if (x <= a[j] && y >= b[j]) cnt[i].first++; } } sort(cnt.rbegin(), cnt.rend()); ll mx = cnt[0].first; vector res; for (ll i = 0; i < m; i++) { if (cnt[i].first == mx) res.push_back(cnt[i].second); } sort(res.begin(), res.end()); for (ll i = 0; i < res.size(); i++) printf("%lld\n", res[i]); return 0; }