#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int SQRT_N = 317;
const int MAX_N = SQRT_N*SQRT_N;
int dat[MAX_N] = {};
int bucket_min[SQRT_N] = {};
int lazy_bucket_update[SQRT_N] = {};
bool lazy_flag_update[SQRT_N] = {};

void init() {
	rep(i, 0, MAX_N) {
		dat[i] = 0;
	}
	rep(k, 0, SQRT_N) {
		bucket_min[k] = 0;
	}
}

void update(int l, int r, int val) {
	for (int k = 0; k < SQRT_N; k++) {
		int bl = k * SQRT_N, br = (k + 1) * SQRT_N;
		if (r <= bl || br <= l)
			continue;
		if (l <= bl && br <= r) {
			lazy_bucket_update[k] = val;
			lazy_flag_update[k] = true;
			bucket_min[k] = val;
		}
		else {
			if (lazy_flag_update[k]) {
				for (int i = bl; i < br; i++) {
					dat[i] = lazy_bucket_update[k];
				}
				lazy_flag_update[k] = false;
			}
			for (int i = max(l, bl); i < min(r, br); i++) {
				dat[i] = val;
			}
			int mini = dat[bl];
			for (int i = bl; i < br; i++) {
				chmin(mini, dat[i]);
			}
			bucket_min[k] = mini;
		}
	}
}

int find(int l, int r) {
	int mini = 1;
	for (int k = 0; k < SQRT_N; k++) {
		int bl = k * SQRT_N, br = (k + 1) * SQRT_N;
		if (r <= bl || br <= l)
			continue;
		if (l <= bl && br <= r) {
			chmin(mini, bucket_min[k]);
		}
		else {
			if (lazy_flag_update[k]) {
				for (int i = bl; i < br; i++) {
					dat[i] = lazy_bucket_update[k];
				}
				lazy_flag_update[k] = false;
			}
			for (int i = max(l, bl); i < min(r, br); i++) {
				chmin(mini, dat[i]);
			}
		}
	}
	return mini;
}

template<class T, class ...Tail>
void tiedSort(vector<T> &a, vector<Tail>&... tail) {
	int n = a.size();
	using S = tuple<T, Tail...>;
	vector<S> s(n);
	for (int i = 0; i < n; i++)
		s[i] = make_tuple(a[i], tail[i]...);
	sort(s.begin(), s.end());
	for (int i = 0; i < n; i++)
		tie(a[i], tail[i]...) = s[i];
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M, Q; cin >> N >> M >> Q;
	vector<int> D(M), A(M), B(M); rep(i, 0, M) {
		cin >> D[i] >> A[i] >> B[i];
		A[i]--, B[i]--;
	}
	tiedSort(D, A, B);
	dump(D, A, B);
	vector<int> idx(Q); iota(all(idx), 0);
	vector<int> E(Q), S(Q), T(Q); rep(i, 0, Q) {
		cin >> E[i] >> S[i] >> T[i];
		S[i]--, T[i]--;
	}
	tiedSort(E, S, T, idx);
	dump(E, S, T,idx);
	init();
	vector<string> ans(Q);
	int m = 0;
	rep(q, 0, Q) {
		while (m < M&&D[m] < E[q]) {
			update(A[m], B[m], 1);
			m++;
		}
		if (S[q] >= T[q]) {
			ans[idx[q]] = "Yes";
		}
		else {
			if (find(S[q], T[q]) == 1) {
				ans[idx[q]] = "Yes";
			}
			else {
				ans[idx[q]] = "No";
			}
		}
		//cout << dat[0]; rep(i, 1, N) { cout << " " << dat[i]; } cout << endl;
	}
	rep(i, 0, ans.size()) { cout << ans[i] << endl; }
	return 0;
}

### Prompt

Your challenge is to write a cpp solution to 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 "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int SQRT_N = 317;
const int MAX_N = SQRT_N*SQRT_N;
int dat[MAX_N] = {};
int bucket_min[SQRT_N] = {};
int lazy_bucket_update[SQRT_N] = {};
bool lazy_flag_update[SQRT_N] = {};

void init() {
	rep(i, 0, MAX_N) {
		dat[i] = 0;
	}
	rep(k, 0, SQRT_N) {
		bucket_min[k] = 0;
	}
}

void update(int l, int r, int val) {
	for (int k = 0; k < SQRT_N; k++) {
		int bl = k * SQRT_N, br = (k + 1) * SQRT_N;
		if (r <= bl || br <= l)
			continue;
		if (l <= bl && br <= r) {
			lazy_bucket_update[k] = val;
			lazy_flag_update[k] = true;
			bucket_min[k] = val;
		}
		else {
			if (lazy_flag_update[k]) {
				for (int i = bl; i < br; i++) {
					dat[i] = lazy_bucket_update[k];
				}
				lazy_flag_update[k] = false;
			}
			for (int i = max(l, bl); i < min(r, br); i++) {
				dat[i] = val;
			}
			int mini = dat[bl];
			for (int i = bl; i < br; i++) {
				chmin(mini, dat[i]);
			}
			bucket_min[k] = mini;
		}
	}
}

int find(int l, int r) {
	int mini = 1;
	for (int k = 0; k < SQRT_N; k++) {
		int bl = k * SQRT_N, br = (k + 1) * SQRT_N;
		if (r <= bl || br <= l)
			continue;
		if (l <= bl && br <= r) {
			chmin(mini, bucket_min[k]);
		}
		else {
			if (lazy_flag_update[k]) {
				for (int i = bl; i < br; i++) {
					dat[i] = lazy_bucket_update[k];
				}
				lazy_flag_update[k] = false;
			}
			for (int i = max(l, bl); i < min(r, br); i++) {
				chmin(mini, dat[i]);
			}
		}
	}
	return mini;
}

template<class T, class ...Tail>
void tiedSort(vector<T> &a, vector<Tail>&... tail) {
	int n = a.size();
	using S = tuple<T, Tail...>;
	vector<S> s(n);
	for (int i = 0; i < n; i++)
		s[i] = make_tuple(a[i], tail[i]...);
	sort(s.begin(), s.end());
	for (int i = 0; i < n; i++)
		tie(a[i], tail[i]...) = s[i];
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M, Q; cin >> N >> M >> Q;
	vector<int> D(M), A(M), B(M); rep(i, 0, M) {
		cin >> D[i] >> A[i] >> B[i];
		A[i]--, B[i]--;
	}
	tiedSort(D, A, B);
	dump(D, A, B);
	vector<int> idx(Q); iota(all(idx), 0);
	vector<int> E(Q), S(Q), T(Q); rep(i, 0, Q) {
		cin >> E[i] >> S[i] >> T[i];
		S[i]--, T[i]--;
	}
	tiedSort(E, S, T, idx);
	dump(E, S, T,idx);
	init();
	vector<string> ans(Q);
	int m = 0;
	rep(q, 0, Q) {
		while (m < M&&D[m] < E[q]) {
			update(A[m], B[m], 1);
			m++;
		}
		if (S[q] >= T[q]) {
			ans[idx[q]] = "Yes";
		}
		else {
			if (find(S[q], T[q]) == 1) {
				ans[idx[q]] = "Yes";
			}
			else {
				ans[idx[q]] = "No";
			}
		}
		//cout << dat[0]; rep(i, 1, N) { cout << " " << dat[i]; } cout << endl;
	}
	rep(i, 0, ans.size()) { cout << ans[i] << endl; }
	return 0;
}

```