#include using namespace std; #pragma region template using i32 = int32_t;using i64 = int64_t;using u32 = uint32_t;using u64 = uint64_t;using f32 = float;using f64 = double;using f80 = long double; using i128 = __int128_t;using u128 = __uint128_t; using vi32 = vector;using vi64 = vector;using vu32 = vector;using vu64 = vector; using vvi32 = vector>;using vvi64 = vector>;using vvu32 = vector>;using vvu64 = vector>; using pi32 = pair;using pi64 = pair;using Pu32 = pair;using Pu64 = pair; using vpi32 = vector;using vpi64 = vector;using vpu32 = vector;using vpu64 = vector; #define FOR(i,a,b) for(i64 i=(a), i##_len=(b); ii##_len; --i) #define REP(i,n) FOR(i,0,n) #define ALL(obj) (obj).begin(),(obj).end() #define CLR(ar,val) memset(ar, val, sizeof(ar)) #define SZ(obj) (static_cast(obj.size())) #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()); #define pb push_back #define mp make_pair #define fst first #define snd second #define PRINT(obj) std::cout<<((obj))< inline bool chmax(T &a, const T &b) { if (a inline bool chmin(T &a, const T &b) { if (b std::istream &operator>>(std::istream &is, std::pair &p) { is >> p.first >> p.second;return is; } template std::ostream &operator<<(std::ostream &os, const std::pair& p) { os << p.first << ' ' << p.second;return os; } template std::istream &operator>>(std::istream &is, std::vector &v) { for(T& in : v) is >> in; return is; } template std::ostream &operator<<(std::ostream &os, const std::vector &v) { for(i32 i = 0; i < SZ(v); i++) os << v[i] << (i+1 != SZ(v) ? " " : ""); return os; } string i128toString(i128 value) { string output; while (output.empty() || value > 0) { output = (char)(value % 10 + '0') + output; value /= 10; } return output; } istream& operator>>(istream &stream, i128 &v) { string s; stream >> s; bool neg = false; if(s[0] == '-') { s.erase(0, 1); neg = true; } int len = s.length(); v = 0; for(int32_t i = 0; i < len;++i) { v = v * 10 + s[i] - '0'; } if(neg) { v = -v; } return stream; } ostream& operator<<(ostream &stream, i128 v) { if (v == 0) { stream << "0"; } else { if(v < 0) { stream << "-"; v = -v; } stream << i128toString(v); } return stream; } string u128toString(u128 value) { string output; while (output.empty() || value > 0) { output = (char)(value % 10 + '0') + output; value /= 10; } return output; } istream& operator>>(istream &stream, u128 &v) { string s; stream >> s; bool neg = false; if(s[0] == '-') { s.erase(0, 1); neg = true; } int len = s.length(); v = 0; for(int32_t i = 0; i < len;++i) { v = v * 10 + s[i] - '0'; } if(neg) { v = -v; } return stream; } ostream& operator<<(ostream &stream, u128 v) { if (v == 0) { stream << "0"; } else { if(v < 0) { stream << "-"; v = -v; } stream << u128toString(v); } return stream; } void Main(); int main() { ios::sync_with_stdio(false); cin.tie(nullptr); std::cout << std::fixed << std::setprecision(10); std::cerr << std::fixed << std::setprecision(10); Main(); return 0; } #pragma endregion void Main(){ int n, m; int a[10005], b[10005], x[1005], y[1005], cnt[1005]; scanf("%d", &n); REP(i,n) scanf("%d%d", &a[i], &b[i]); scanf("%d", &m); REP(i,m) scanf("%d%d", &x[i], &y[i]); REP(i,n)REP(j,m)if(x[j]<=a[i] && y[j]>=b[i])cnt[j]++; int d = 0; REP(i,m) d = max(d, cnt[i]); vector ans; REP(i,m)if(d == cnt[i]) ans.pb(i+1); if (d == 0) PRINT(0) else REP(i,SZ(ans)) PRINT(ans[i]) }