#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(2e5+10); map aa; vector> p(2e5+100); 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)); seg.updata(b,1); seg.updata(c+1,-1); } int q; cin>>q; vi d(2e5+10,0); rep(i,q){ int c; cin>>c; if(c==1){ string s; cin>>s; int t; cin>>t; int kk=aa[s]; if(d[kk]==0) { sort(all(p[kk])); d[kk]=1; } int ok=0,ng=p[kk].size(); if(p[kk][0].first>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"<>t; cout<>s; int x,y; cin>>x>>y; if(aa[s]==0){ aa[s]=k; k++; } p[aa[s]].pb(mp(x,y)); d[aa[s]]=0; seg.updata(x,1); seg.updata(y+1,-1); } } }