#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; #include #include using namespace __gnu_pbds; template using Tree=tree,rb_tree_tag,tree_order_statistics_node_update>; template struct SegTreeLazy { using FX=function; using FA=function; using FM=function; int n; FX fx; FA fa; FM fm; const X ex; const M em; vector dat; vector lazy; SegTreeLazy(int n_,FX fx_,FA fa_,FM fm_,X ex_,M em_) : n(),fx(fx_),fa(fa_),fm(fm_),ex(ex_),em(em_),dat(n_*4,ex),lazy(n_*4,em) { int x=1; while (n_ > x) x*=2; n=x; } void set(int i,X x){dat[i+n-1]=x;} void build(){ for(int k=n-2;k>=0;k--) dat[k]=fx(dat[2*k+1],dat[2*k+2]); } void eval(int k){ if(lazy[k]==em) return; if(k A[100100]; set B[100100]; set AA[100100]; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin>>n; vector X(n); vector L(n),R(n); map m; int now=0; set s; rep(i,n){ cin>>X[i]>>L[i]>>R[i]; if(!m.count(X[i])){ m[X[i]]=now; now++; } s.insert(L[i]); s.insert(R[i]); A[m[X[i]]].insert(L[i]); A[m[X[i]]].insert(R[i]); B[m[X[i]]].insert(R[i]); AA[m[X[i]]].insert(L[i]); AA[m[X[i]]].insert(R[i]); } int q; cin>>q; vector c(q),x(q),t(q,-1),l(q,-1),r(q,-1); rep(i,q){ int d; cin>>d; c[i]=d; if(d==1){ string e; int f; cin>>e>>f; if(!m.count(e)){ m[e]=now; now++; } x[i]=m[e],t[i]=f; s.insert(f); } else if(d==2){ int e; cin>>e; t[i]=e; s.insert(e); } else{ string e; int f,g; cin>>e>>f>>g; if(!m.count(e)){ m[e]=now; now++; } x[i]=m[e],l[i]=f,r[i]=g; s.insert(f); s.insert(g); A[i].insert(f); A[i].insert(g); AA[i].insert(f); AA[i].insert(g); } } map m1; now=0; for(auto p:s){ m1[p]=now; now++; } using XX=int; using M=int; auto fx=[](XX x1,XX x2) -> XX { return max(x1,x2);}; auto fa=[](XX x,M m) -> XX { return x+m;}; auto fm=[](M m1,M m2) -> M { return m1+m2;}; XX ex=0; M em=0; SegTreeLazy seg(200200,fx,fa,fm,ex,em); rep(i,n){ seg.update(m1[L[i]],m1[R[i]]+1,1); } rep(i,q){ if(c[i]==1){ auto d=A[x[i]].order_of_key(t[i]); if(d%2==0){ d++; if(AA[x[i]].count(t[i]) && B[x[i]].count(*A[x[i]].find_by_order(d))) cout<<"Yes\n"; else cout<<"No\n"; } else{ if(B[x[i]].count(*A[i].find_by_order(d))) cout<<"Yes\n"; else cout<<"No\n"; } } else if(c[i]==2){ cout<