#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #define rep(i,n) for(ll i=0;i<(n);++i) #define reps(i,n) for(ll i=1;i<=(n);++i) #define repr(i,n) for(ll i=2;i*i<=(n);++i) #define ll long long #define all(x) (x).begin(),(x).end() #define sz(x) ((string)(x).size()) #define pb push_back #define pob pop_back() #define MMod (ll)1000000007 #define mmod (ll)998244353 #define setp(x) setprecision((ll)(x)) #define INF (ll)(1000000000000000000) #define mp make_pair using namespace std; using pii=pair; using pll=pair; using vi=vector; using vc=vector; using vb=vector; using vl=vector; using vvi=vector; using vvl=vector; using vvc=vector; using vvb=vector; using vpi=vector; using vpl=vector>; using vs=vector; using pqi=priority_queue; vpi fs={mp(1,0),mp(-1,0),mp(0,1),mp(0,-1)}; struct segment{ vector value; int N; segment(int n){ N=1; while(N0){ i=(i-1)/2; value[i]=(value[i*2+1]+value[i*2+2]); } } ll quety(int a,ll b,int k,int l,int r){ if(r<=a||b<=l){ return(0); } if(a<=l&&r<=b){ return(value[k]); }else{ ll c1=quety(a,b,2*k+1,l,(l+r)/2); ll c2=quety(a,b,2*k+2,(l+r)/2,r); return(c1+c2); } } ll get(int a,ll b){ return(quety(a,b+1,0,0,N)); } }; int main(){ int n; cin>>n; int k=1; segment seg(5e5+10); map aa; vector> p(5e5+100); vpi pp; vi ppp; rep(i,n){ string a; cin>>a; int b,c; cin>>b>>c; if(aa[a]==0){ aa[a]=k; k++; } p[aa[a]].pb(mp(b,c)); pp.pb(mp(b,c)); ppp.pb(b); ppp.pb(c); } int qq; cin>>qq; vvi q(qq,vi(3)); map ss; rep(i,qq){ cin>>q[i][0]; if(q[i][0]==1) { string v; cin>>v; cin>>q[i][1]; ss[i]=v; } else if(q[i][0]==2) { cin>>q[i][1]; ppp.pb(q[i][1]); } else if(q[i][0]==3) { string v; cin>>v; ss[i]=v; cin>>q[i][1]>>q[i][2]; ppp.pb(q[i][1]); ppp.pb(q[i][2]); } } int jj=1; map aaa; sort(all(ppp)); rep(i,ppp.size()){ if(aaa[ppp[i]]==0){ aaa[ppp[i]]=jj; jj++; } } rep(i,pp.size()){ int g=aaa[pp[i].first],h=aaa[pp[i].second]; seg.updata(g,1); seg.updata(h+1,-1); } vi d(2e5+10,0); rep(i,qq){ int c=q[i][0]; /*if(c==1){ string s=ss[i]; int t=q[i][1]; if(aa[s]==0) { aa[s]=k; k++; cout<<"No"<t){ cout<<"No"<1){ int j=(ok+ng)/2; if(p[kk][j].first>t) ng=t; else ok=t; } if(p[kk][ok].second>=t) cout<<"Yes"<