#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fst first
#define snd second
#define pb push_back
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(),x.end()
#define forn(i,a,b) for(int i = a; i<b; i++)
#define mset(a,v) memset(a,v,sizeof(a))
#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
template< typename T >
using iset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
int main(){
ll n; cin>>n;
vector<ll> a(n); forn(i,0,n) cin>>a[i];
vector<ll> b(n); forn(i,0,n) cin>>b[i];
ll q; cin>>q;
forn(iqq,0,q){
ll l,r; cin>>l>>r; l--; r--;
bool yes = true;
vector<pair<ll,ll>> ord; forn(i,l,r+1) ord.pb({a[i],b[i]});
sort(ALL(ord));
ll maxib = 0;
ll last = -1;
forn(i,0,SZ(ord)){
ll I = -1;
forn(j,i+1,SZ(ord)){
if(ord[j].snd<=ord[i].fst) I=j;
}
if(I==-1 && last<i){
yes=false;
break;
}
//cout<<i<<" to "<<I<<'\n';
last=I;
}
if(yes) cout<<"Yes\n";
else cout<<"No\n";
}
return 0;
}