#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<numeric>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define stop char nyaa;cin>>nyaa;

//keta,Nより小さい,51?3の回数
ll dp[19][2][5];



void solve() {
	int n, m, q;
	cin >> n >> m >> q;
	vector<int> d(m + q), a(m + q), b(m + q);
	rep(i, m + q) {
		cin >> d[i] >> a[i] >> b[i];
		--a[i]; --b[i];
	}
	vector<int> ord(m + q);
	iota(ord.begin(), ord.end(), 0);
	sort(ord.begin(), ord.end(), [&](int x, int y) {
		if (d[x] == d[y])return x > y;
		return d[x] < d[y];
	});
	set<pair<int, int>> st;
	rep(i, n + 2) {
		st.insert({ i - 1,i-1 });
	}vector<string> ans(q);
	for (auto i : ord) {
		if (i >= m) {
			if (a[i] > b[i])ans[i - m] = "Yes";
			else {
				auto itr = st.lower_bound({ a[i],a[i] });
				if (itr->first > a[i])--itr;
				if (itr->second >= b[i])ans[i - m] = "Yes";
				else ans[i - m] = "No";
			}
		}
		else {
			auto itr = st.lower_bound({ a[i],a[i] });
			if (itr->first > a[i])--itr;
			int l = itr->first;
			int r = b[i];
			while (itr->second < b[i]) {
				r = itr->second;
				itr = st.erase(itr);
			}
			r = itr->second;
			itr = st.erase(itr);
			st.insert({ l,r });
		}
	}
	rep(i, q) {
		cout << ans[i] << endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	stop
	return 0;
}

### Prompt

Create a solution in CPP for the following problem:

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<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<numeric>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define stop char nyaa;cin>>nyaa;

//keta,Nより小さい,51?3の回数
ll dp[19][2][5];



void solve() {
	int n, m, q;
	cin >> n >> m >> q;
	vector<int> d(m + q), a(m + q), b(m + q);
	rep(i, m + q) {
		cin >> d[i] >> a[i] >> b[i];
		--a[i]; --b[i];
	}
	vector<int> ord(m + q);
	iota(ord.begin(), ord.end(), 0);
	sort(ord.begin(), ord.end(), [&](int x, int y) {
		if (d[x] == d[y])return x > y;
		return d[x] < d[y];
	});
	set<pair<int, int>> st;
	rep(i, n + 2) {
		st.insert({ i - 1,i-1 });
	}vector<string> ans(q);
	for (auto i : ord) {
		if (i >= m) {
			if (a[i] > b[i])ans[i - m] = "Yes";
			else {
				auto itr = st.lower_bound({ a[i],a[i] });
				if (itr->first > a[i])--itr;
				if (itr->second >= b[i])ans[i - m] = "Yes";
				else ans[i - m] = "No";
			}
		}
		else {
			auto itr = st.lower_bound({ a[i],a[i] });
			if (itr->first > a[i])--itr;
			int l = itr->first;
			int r = b[i];
			while (itr->second < b[i]) {
				r = itr->second;
				itr = st.erase(itr);
			}
			r = itr->second;
			itr = st.erase(itr);
			st.insert({ l,r });
		}
	}
	rep(i, q) {
		cout << ans[i] << endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	stop
	return 0;
}

```