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

Solution (in CPP):

Solution:

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int N, M, Q;

struct query {
	int T;
	int make;//0:ques 1:make
	int A, B;
	int id;
};

vector<int>par;
int getPar(int x) {
	if (x == par[x])return x;
	return par[x] = getPar(par[x]);
}
void unite(int a, int b) {
	a = getPar(a);
	b = getPar(b);
	if (a == b) {
		return;
	}
	if (a > b) {
		par[b] = a;
	}
	else {
		par[a] = b;
	}
}

int main(void)
{
	cin >> N >> M >> Q;
	vector<query>que;
	for (int i = 0; i < N; ++i) {
		par.push_back(i);
	}
	for (int i = 0; i < M; ++i) {
		int d, a, b;
		cin >> d >> a >> b;
		--a; --b;
		que.push_back({ d,1,a,b });
	}
	set<int>suk;
	for (int i = 0; i < N - 1; ++i) {
		suk.insert(i);
	}
	for (int i = 0; i < Q; ++i) {
		int e, s, t;
		cin >> e >> s >> t;
		--s; --t;
		que.push_back({ e,0,s,t,i });
	}
	sort(que.begin(), que.end(), [](const query&q1, const query&q2) {
		return make_pair(q1.T, q1.make) < make_pair(q2.T, q2.make);
	});
	vector<pair<int, bool>>ans;
	for (auto&q : que) {
		int T = q.T;
		int make = q.make;
		if (make == 1) {
			int A = q.A;
			int B = q.B;
			auto itr = suk.lower_bound(A);
			auto ptr = suk.lower_bound(B);
			while (itr != ptr) {
				int x = *itr;
				unite(x, x + 1);
				//++itr;
				itr = suk.erase(itr);
			}
		}
		else {
			int S = q.A;
			int T = q.B;
			int id = q.id;
			if (S >= T) {
				//cout << "Yes" << endl;
				ans.push_back({ id,true });
			}
			else {
				int SS = getPar(S);
				if (SS >= T) {
					//cout << "Yes" << endl;
					ans.push_back({ id,true });
				}
				else {
					//cout << "No" << endl;
					ans.push_back({ id,false });
				}
			}
		}
	}
	sort(ans.begin(), ans.end());
	for (auto x : ans) {
		cout << (x.second ? "Yes" : "No") << endl;
	}
	return 0;
}