#include #include void solve() { int n; std::cin >> n; std::vector> ps(n); for (auto& p : ps) std::cin >> p.first >> p.second; int m; std::cin >> m; std::vector> qs(m); for (auto& q : qs) std::cin >> q.first >> q.second; std::vector cnt(m, 0); for (auto p : ps) { for (int i = 0; i < m; ++i) { auto q = qs[i]; if (q.first <= p.first && p.second <= q.second) { ++cnt[i]; } } } std::vector ans; int max = 0; for (int i = 0; i < m; ++i) { if (cnt[i] > max) { max = cnt[i]; ans.clear(); } if (cnt[i] == max) { ans.push_back(i + 1); } } if (max == 0) { std::cout << 0 << std::endl; } else { for (auto a : ans) std::cout << a << std::endl; } } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }