#include using namespace std; #define ALL(x) begin(x),end(x) #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b ostream &operator<<(ostream &os,const vector&v){ for(int i=0;i<(int)v.size();i++) os< istream &operator>>(istream &is,vector&v){ for(T &x:v)is>>x; return is; } signed main(){ int n;cin>>n; vector a(n),b(n); rep(i,n) cin>>a[i]>>b[i]; int m;cin>>m; vector x(m),y(m); rep(i,m) cin>>x[i]>>y[i]; vector cnt(m,0); rep(i,n){ rep(j,m){ if(x[j]<=a[i] and y[j]>=b[i]) cnt[j]++; } } if(*max_element(ALL(cnt))==0) cout<<0<