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 <bits/stdc++.h>

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9 + 7;
const i64 INF = 1e18 + 7;

struct Segtree{
    int n;
    vector<int> elm;
    Segtree(int n) : n(n), elm(2 * n){
        for(int i = 0; i < n; ++i)
            elm[i + n] = i;
        for(int i = n - 1; i >= 1; --i)
            elm[i] = max(elm[2 * i], elm[2 * i + 1]);
    }

    void update(int x, int val){
        x += n;
        elm[x] = max(val, elm[x]);
        while(x >>= 1)
            elm[x] = max(elm[2 * x], elm[2 * x + 1]);
    }

    int get(int x, int y){
        int l = -MOD, r = -MOD;
        for(x += n, y += n - 1; x <= y; x >>= 1, y >>= 1){
            if(x & 1)
                l = max(l, elm[x++]);
            if(!(y & 1))
                r = max(elm[y--], r);
        }
        return max(l, r);
    }
};

signed main(){
    int n, m, q;
    cin >> n >> m >> q;
    vector<int> d(m), a(m), b(m);
    // day, type, idx
    vector<tuple<int,int,int>> query;
    for(int i = 0; i < m; ++i){
        cin >> d[i] >> a[i] >> b[i];
        --a[i], --b[i];
        query.emplace_back(d[i], 1, i);
    }
    vector<int> e(q), s(q), t(q);
    for(int i = 0; i < q; ++i){
        cin >> e[i] >> s[i] >> t[i];
        --s[i], --t[i];
        query.emplace_back(e[i], 0, i);
    }

    sort(query.begin(), query.end());

    Segtree seg(n);
    vector<int> ans(q, -1);

    // segtree and union findd
    for(auto& que : query){
        int type, i;
        tie(ignore, type, i) = que;
        if(type == 1){
            seg.update(a[i], b[i]);
        }else{
            int pos = -1, nex = s[i];
            while(pos != nex){
                pos = nex;
                nex = seg.get(0, pos + 1);
            }
            seg.update(s[i], pos);
            ans[i] = (pos >= t[i]);
        }
        /*
        if(get<1>(que)){
            cout << get<0>(que) << " : ";
            for(int i = 0; i < n; ++i)
                cout << seg.get(i, i + 1) << " \n"[i == n - 1];
        }
        */
    }
    for(int i = 0; i < q; ++i){
        cout << (ans[i] ? "Yes" : "No") << endl;
    }

}