#include <bits/stdc++.h>
#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;
typedef long long ll;
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(i,0,q){
ll l,r; cin>>l>>r; l--; r--;
bool yes=true;
forn(j,l,r+1){
bool intersect = false;
forn(k,l,r+1){
if(j==k) continue;
if(a[k]>a[j]&& a[j]>b[k]) intersect=true;
if(a[j]>a[k]&& a[k]>b[j]) intersect=true;
}
if(!intersect)yes=false;
}
if(yes) cout<<"Yes\n";
else cout<<"No\n";
}
return 0;
}