#include using namespace std; typedef long long ll; struct mantaiko{ int price = 0; int hot = 0; }; int main(){ int n, m, p, h, t; cin >> n; mantaiko ideal[n]; for (int i = 0; i < n; i++){ cin >> p >> h; ideal[i].price = p; ideal[i].hot = h; } cin >> m; mantaiko shop[m]; int count[m] = {}; for (int i = 0; i < m; i++){ cin >> p >> h; shop[i].price = p; shop[i].hot = h; } t = 0; for (auto y : shop){ for (auto x : ideal){ if (x.price >= y.price && x.hot <= y.hot){ count[t] += 1; } } t++; } t = 0; for (auto y : count){ t = max(t, y); } for (int i = 0; i < m; i++){ if (t == count[i]) cout << i+1 << endl; } return 0; }