50pts,T了5个点
#include<bits/stdc++.h>
using namespace std;
const int N=5e4+15;
int n,m,y[N],r[N];
map <int,int> mp;
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>y[i]>>r[i];
mp[y[i]]=i;
}
mp[1e9+7]=n+1;
cin>>m;
for(int i=1;i<=m;i++)
{
int b,e;
cin>>b>>e;
if(mp.find(b)==mp.end()&&mp.find(e)==mp.end())
{
cout<<"maybe"<<endl;
}
else if(mp.find(b)==mp.end())
{
bool c=true;
for(int j=mp.upper_bound(b)->second;j<mp.find(e)->second;j++)
{
if(r[j]>=r[mp.find(e)->second])
{
cout<<"false"<<endl;
c=false;
break;
}
}
if(c)
{
cout<<"maybe"<<endl;
}
}
else if(mp.find(e)==mp.end())
{
bool c=true;
for(int j=mp.upper_bound(e)->second-1;j>mp.find(b)->second;j--)
{
if(r[j]>=r[mp.find(b)->second])
{
cout<<"false"<<endl;
c=false;
break;
}
}
if(c)
{
cout<<"maybe"<<endl;
}
}
else
{
if(r[mp.find(b)->second]<r[mp.find(e)->second])
{
cout<<"false"<<endl;
}
else
{
bool c=true;
for(int j=mp.find(b)->second+1;j<mp.find(e)->second;j++)
{
if(r[j]>=r[mp.find(e)->second])
{
cout<<"false"<<endl;
c=false;
break;
}
}
if(c)
{
if((mp.find(e)->second)-(mp.find(b)->second)==e-b)
{
cout<<"true"<<endl;
}
else
{
cout<<"maybe"<<endl;
}
}
}
}
}
return 0;
}