#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef pair<int,int> P;

struct query{
	int day;
	int l,r;
	int type;
	int id;
	query(){}
	query(int dd,int ll,int rr,int tt,int ii){
		day=dd;
		l=ll;
		r=rr;
		type=tt;
		id=ii;
	}
	bool operator<(const query &q)const{
		return day<q.day;
	}
};

struct segtree{
	static const int N=1<<18;
	int dp[1<<19];
	int lazy[1<<19];
	segtree(){}
	void lazy_eval(int k){
		if(lazy[k]==0)return;
		dp[k]=lazy[k];
		if(k<N-1){
			lazy[k*2+1]=lazy[k]/2;
			lazy[k*2+2]=lazy[k]/2;
		}
		lazy[k]=0;
	}
	void lazy_upd(int k){
		dp[k]=dp[k*2+1]+dp[k*2+2];
	}
	void update(int a,int b,int k=0,int l=0,int r=N){
		lazy_eval(k);
		if(b<=l || r<=a)return;
		if(a<=l && r<=b){
			lazy[k]=r-l;
			lazy_eval(k);
			return;
		}
		int mid=(l+r)/2;
		update(a,b,k*2+1,l,mid);
		update(a,b,k*2+2,mid,r);
		lazy_upd(k);
	}

	int query(int a,int b,int k=0,int l=0,int r=N){
		lazy_eval(k);
		if(b<=l || r<=a)return 0;
		if(a<=l && r<=b)return dp[k];
		int mid=(l+r)/2;
		int vl=query(a,b,k*2+1,l,mid);
		int vr=query(a,b,k*2+2,mid,r);
		lazy_upd(k);
		return vl+vr;	
	}
};

int n,m,q;
int d,e;
segtree seg;
vector<query> vec;
bool ans[100001];

int main(void){
	scanf("%d%d%d",&n,&m,&q);
	for(int i=0;i<m;i++){
		int d,a,b;
		scanf("%d%d%d",&d,&a,&b);
		a--;
		d*=2;
		d++;
		vec.push_back(query(d,a,b,0,-1));
	}
	for(int i=0;i<q;i++){
		int e,s,t;
		scanf("%d%d%d",&e,&s,&t);
		s--;
		e*=2;
		vec.push_back(query(e,s,t,1,i));
	}
	sort(vec.begin(),vec.end());
	for(int i=0;i<vec.size();i++){
		if(vec[i].type==0){
			seg.update(vec[i].l*2+1,vec[i].r*2-1);
		}else{
			if(vec[i].l+1>=vec[i].r){
				ans[vec[i].id]=true;
				continue;
			}
			int val=seg.query(vec[i].l*2+1,vec[i].r*2-1);
			//printf("%d %d\n",vec[i].id,val);
			if(val==(vec[i].r-vec[i].l)*2-2)ans[vec[i].id]=true;
		}
	}
	for(int i=0;i<q;i++){
		printf("%s\n",ans[i]?"Yes":"No");
	}
	return 0;
}

### Prompt

Construct a CPP code solution to the problem outlined:

problem

AOR Co., Ltd. is a $ N $ story building. There is no basement floor.
AOR Ika-chan is a squid, so she can go down the stairs, but not up.

I decided to install $ M $ elevators in the building because it would be inconvenient if I couldn't climb upstairs.
It takes time to install the elevator, and the $ i $ th elevator will be installed the night after $ D_i $ and will be mobile on all floors above the $ A_i $ floor and below the $ B_i $ floor.

You were asked $ Q $ questions by AOR Ika-chan. The $ i $ th question is, "Can I move from the $ S_i $ floor to the $ T_i $ floor at noon $ E_i $ days later?"
The only means of transportation are stairs and elevators. In addition, the time required for movement shall be negligible.



input

$ N \ M \ Q $
$ D_1 \ A_1 \ B_1 $
$ \ vdots $
$ D_M \ A_M \ B_M $
$ E_1 \ S_1 \ T_1 $
$ \ vdots $
$ E_Q \ S_Q \ T_Q $

output

Print Yes or No on one line for each question. However, answer in the order in which they are asked. Also, output a line break at the end.

Example

Input

5 1 2
3 1 5
3 1 5
4 1 5


Output

No
Yes

### Response

```cpp
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef pair<int,int> P;

struct query{
	int day;
	int l,r;
	int type;
	int id;
	query(){}
	query(int dd,int ll,int rr,int tt,int ii){
		day=dd;
		l=ll;
		r=rr;
		type=tt;
		id=ii;
	}
	bool operator<(const query &q)const{
		return day<q.day;
	}
};

struct segtree{
	static const int N=1<<18;
	int dp[1<<19];
	int lazy[1<<19];
	segtree(){}
	void lazy_eval(int k){
		if(lazy[k]==0)return;
		dp[k]=lazy[k];
		if(k<N-1){
			lazy[k*2+1]=lazy[k]/2;
			lazy[k*2+2]=lazy[k]/2;
		}
		lazy[k]=0;
	}
	void lazy_upd(int k){
		dp[k]=dp[k*2+1]+dp[k*2+2];
	}
	void update(int a,int b,int k=0,int l=0,int r=N){
		lazy_eval(k);
		if(b<=l || r<=a)return;
		if(a<=l && r<=b){
			lazy[k]=r-l;
			lazy_eval(k);
			return;
		}
		int mid=(l+r)/2;
		update(a,b,k*2+1,l,mid);
		update(a,b,k*2+2,mid,r);
		lazy_upd(k);
	}

	int query(int a,int b,int k=0,int l=0,int r=N){
		lazy_eval(k);
		if(b<=l || r<=a)return 0;
		if(a<=l && r<=b)return dp[k];
		int mid=(l+r)/2;
		int vl=query(a,b,k*2+1,l,mid);
		int vr=query(a,b,k*2+2,mid,r);
		lazy_upd(k);
		return vl+vr;	
	}
};

int n,m,q;
int d,e;
segtree seg;
vector<query> vec;
bool ans[100001];

int main(void){
	scanf("%d%d%d",&n,&m,&q);
	for(int i=0;i<m;i++){
		int d,a,b;
		scanf("%d%d%d",&d,&a,&b);
		a--;
		d*=2;
		d++;
		vec.push_back(query(d,a,b,0,-1));
	}
	for(int i=0;i<q;i++){
		int e,s,t;
		scanf("%d%d%d",&e,&s,&t);
		s--;
		e*=2;
		vec.push_back(query(e,s,t,1,i));
	}
	sort(vec.begin(),vec.end());
	for(int i=0;i<vec.size();i++){
		if(vec[i].type==0){
			seg.update(vec[i].l*2+1,vec[i].r*2-1);
		}else{
			if(vec[i].l+1>=vec[i].r){
				ans[vec[i].id]=true;
				continue;
			}
			int val=seg.query(vec[i].l*2+1,vec[i].r*2-1);
			//printf("%d %d\n",vec[i].id,val);
			if(val==(vec[i].r-vec[i].l)*2-2)ans[vec[i].id]=true;
		}
	}
	for(int i=0;i<q;i++){
		printf("%s\n",ans[i]?"Yes":"No");
	}
	return 0;
}

```