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 <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
struct Query {
    int day, lhs, rhs, mode, idx;
    bool operator<(const Query &q) const {
        if(day != q.day) return day < q.day;
        return mode < q.mode;
    }
};

// Abstract Segment Tree (抽象・汎化セグメント木)
// Verified: AOJ DSL_2_A: Range Minimum Query (int型のみ)

const int SIZE = 1 << 17; // 2^17 = 131072
template<typename T>
struct segtree {
    // ノード、単位元
    T node[2*SIZE], I;

    // オペレーション (update, query の 2 つが必要？)
    T (*upd_f)(T, T), (*qry_f)(T, T);

    // 演算子と単位元をセットし、全ての node を単位元で初期化
    segtree(T (*op1)(T, T), T (*op2)(T, T), T X) {
        upd_f = op1;
        qry_f = op2;
        I = X;
        fill(node, node+2*SIZE, I);
    }

    // 配列 vec の値で初期化
    void init(vector<T> vec) {
        int N = (int)vec.size();
        for(int i=0; i<N; i++) {
            node[SIZE-1+i] = vec[i];
        }
        for(int i=SIZE-2; i>=0; i--) {
            node[i] = qry_f(node[2*i+1], node[2*i+2]);
        }
    }

    // 場所 idx に値 val を反映 (upd_f を用いて update)
    void update(int idx, T val) {
        idx += SIZE - 1;
        node[idx] = upd_f(node[idx], val);
        while(idx > 0) {
            // 登るときは qry_f を使うことに注意！！！
            idx = (idx - 1) / 2;
            node[idx] = qry_f(node[2*idx+1], node[2*idx+2]);
        }
    }

    // 半開区間 [a, b) に対してクエリを投げる
    // (qry_f を用いて処理)
    T query(int a, int b, int l=0, int r=SIZE, int k=0) {
        if(b <= l || r <= a) return I;
        if(a <= l && r <= b) return node[k];
        int mid = (l + r) / 2;
        T vl = query(a, b, l, mid, 2*k+1);
        T vr = query(a, b, mid, r, 2*k+2);
        return qry_f(vl, vr);
    }
};

// [[つかいかた]]
// update 用と query 用の関数と単位元 (関数を噛ませても結果が変わらないもの) を用意して宣言する
// 下の例だと、update 用の関数が upd で、query 用の関数が fnd で、単位元が INT_MAX

int upd(int a, int b) {return max(a, b);}
int fnd(int a, int b) {return max(a, b);}
segtree<int> seg(upd, fnd, -1);

signed main() {
    int N, M, Q; cin >> N >> M >> Q;

    vector<Query> querys;
    // Query: 1 -> 判定クエリ、 2 -> 設置クエリ
    for(int i=0; i<M; i++) {
        int D, A, B; cin >> D >> A >> B;
        querys.push_back(Query{D, A, B, 2, -1});
    }

    for(int i=0; i<Q; i++) {
        int E, S, T; cin >> E >> S >> T;
        querys.push_back(Query{E, S, T, 1, i});
    }

    vector<string> ans(Q);
    sort(querys.begin(), querys.end());
    for(int i=0; i<M+Q; i++) {
        if(querys[i].mode == 1) {
            int val = seg.query(0, querys[i].lhs + 1);
            while(1) {
                int tmp = seg.query(0, val + 1);
                if(tmp <= val) break;
                val = tmp;
            }
            if(val >= querys[i].rhs || querys[i].lhs >= querys[i].rhs) {
                ans[ querys[i].idx ] = "Yes";
            }
            else {
                ans[ querys[i].idx ] = "No";
            }
            seg.update(querys[i].lhs, val);
        }
        else {
            int idx = querys[i].lhs, val = querys[i].rhs;
            seg.update(idx, val);
        }
    }

    for(int i=0; i<Q; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}