#include using namespace std; //constant const long long int inf = 1<<30; const int N = 1e4+1; const int M = 1e3+1; //variable int cnt_ment[M]; int a[N],b[N]; int x[M],y[M]; //function int main() { int n,m; cin>>n; for(int i=0; i>a[i]>>b[i]; } cin>>m; for(int i=0; i>x[i]>>y[i]; } for(int i=0; i=x[j]&&b[i]<=y[j]){ cnt_ment[j]++; } } } int ans=distance(cnt_ment,max_element(cnt_ment,&cnt_ment[m])); cout<