#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <array>
#include <bitset>
#include <assert.h>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

struct SqrtDecomposition{
    const int INF = (1LL << 31) - 1;
    int n, sqrtn, k;
    VI dat, buk, lazy;
    vector<bool> lazyflag;

    void init(int x){
        n = x;
        sqrtn = sqrt(n);
        k = (n + sqrtn - 1) / sqrtn;
        dat.assign(sqrtn * k, INF);
        buk.assign(k, INF);
        lazy.assign(k, 0);
        lazyflag.assign(k, false);
    }

    void eval(int b){
        if (!lazyflag[b]) return;
        lazyflag[b] = false;
        FOR(i, sqrtn * b, sqrtn * (b+1) - 1){
            dat[i] = lazy[b];
        }
    }

    // [l, r)
    void update(int l, int r, int x){
        REP(b,k){
            int p = sqrtn * b;
            int q = sqrtn * (b+1);
            if (q <= l || r <= p) continue;
            if (l <= p && q <= r){
                buk[b] = x;
                lazyflag[b] = true;
                lazy[b] = x;
            }else{
                eval(b);
                FOR(i,max(l,p),min(r,q)-1){
                    dat[i] = x;
                }
                buk[b] = INF;
                FOR(i,p,q-1){
                    buk[b] = min(buk[b], dat[i]);
                }
            }
        }
    }

    // [l, r)
    int query(int l, int r){
        int ret = INF;
        REP(b,k){
            int p = sqrtn * b;
            int q = sqrtn * (b+1);
            if (q <= l || r <= p) continue;
            if (l <= p && q <= r){
                ret = min(ret, buk[b]);
            }else{
                eval(b);
                FOR(i,max(l,p),min(r,q)-1){
                    ret = min(ret, dat[i]);
                }
            }
        }
        return ret;
    }
};

int main() {
    int n, m, q;
    cin >> n >> m >> q;

    vector<pair<int, P> > a(m);
    REP(i,m){
        int d = in(), x = in(), y = in();
        x--;y--;
        a[i] = make_pair(d, P(x, y));
    }
    sort(ALL(a));

    vector<pair<P, P> > qry(q);
    REP(i,q){
        int d = in(), x = in(), y = in();
        x--;y--;
        qry[i] = make_pair(P(d, i), P(x, y));
    }
    sort(ALL(qry));

    SqrtDecomposition lower, upper;
    lower.init(n);
    upper.init(n);

    REP(i,n){
        lower.update(i, i+1, i);
        upper.update(i, i+1, i);
    }

    VI ans(q);

    int j = 0;
    REP(i,q){
        while (j < m && a[j].first < qry[i].first.first){
            int x = a[j].second.first;
            int y = a[j].second.second;
            int l = lower.query(x, x+1);
            int u = upper.query(y, y+1);
            // cout << x << " " << y << " " << l << " " << u << endl;
            lower.update(l, u+1, l);
            upper.update(l, u+1, u);
            j++;
        }

        // cout << i << endl;
        // REP(i,n) cout << upper.query(i, i+1) << " ";
        // cout << endl;

        bool ok = false;
        int s = qry[i].second.first;
        int t = qry[i].second.second;
        if (t <= s) ok = true;
        else{
            ok = (upper.query(s, s+1) >= t);
        }
        ans[qry[i].first.second] = ok;
    }

    REP(i,q){
        if (ans[i]) printf("Yes\n");
        else printf("No\n");
    }

    return 0;
}

### Prompt

Develop a solution in CPP to the problem described below:

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 <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <array>
#include <bitset>
#include <assert.h>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

struct SqrtDecomposition{
    const int INF = (1LL << 31) - 1;
    int n, sqrtn, k;
    VI dat, buk, lazy;
    vector<bool> lazyflag;

    void init(int x){
        n = x;
        sqrtn = sqrt(n);
        k = (n + sqrtn - 1) / sqrtn;
        dat.assign(sqrtn * k, INF);
        buk.assign(k, INF);
        lazy.assign(k, 0);
        lazyflag.assign(k, false);
    }

    void eval(int b){
        if (!lazyflag[b]) return;
        lazyflag[b] = false;
        FOR(i, sqrtn * b, sqrtn * (b+1) - 1){
            dat[i] = lazy[b];
        }
    }

    // [l, r)
    void update(int l, int r, int x){
        REP(b,k){
            int p = sqrtn * b;
            int q = sqrtn * (b+1);
            if (q <= l || r <= p) continue;
            if (l <= p && q <= r){
                buk[b] = x;
                lazyflag[b] = true;
                lazy[b] = x;
            }else{
                eval(b);
                FOR(i,max(l,p),min(r,q)-1){
                    dat[i] = x;
                }
                buk[b] = INF;
                FOR(i,p,q-1){
                    buk[b] = min(buk[b], dat[i]);
                }
            }
        }
    }

    // [l, r)
    int query(int l, int r){
        int ret = INF;
        REP(b,k){
            int p = sqrtn * b;
            int q = sqrtn * (b+1);
            if (q <= l || r <= p) continue;
            if (l <= p && q <= r){
                ret = min(ret, buk[b]);
            }else{
                eval(b);
                FOR(i,max(l,p),min(r,q)-1){
                    ret = min(ret, dat[i]);
                }
            }
        }
        return ret;
    }
};

int main() {
    int n, m, q;
    cin >> n >> m >> q;

    vector<pair<int, P> > a(m);
    REP(i,m){
        int d = in(), x = in(), y = in();
        x--;y--;
        a[i] = make_pair(d, P(x, y));
    }
    sort(ALL(a));

    vector<pair<P, P> > qry(q);
    REP(i,q){
        int d = in(), x = in(), y = in();
        x--;y--;
        qry[i] = make_pair(P(d, i), P(x, y));
    }
    sort(ALL(qry));

    SqrtDecomposition lower, upper;
    lower.init(n);
    upper.init(n);

    REP(i,n){
        lower.update(i, i+1, i);
        upper.update(i, i+1, i);
    }

    VI ans(q);

    int j = 0;
    REP(i,q){
        while (j < m && a[j].first < qry[i].first.first){
            int x = a[j].second.first;
            int y = a[j].second.second;
            int l = lower.query(x, x+1);
            int u = upper.query(y, y+1);
            // cout << x << " " << y << " " << l << " " << u << endl;
            lower.update(l, u+1, l);
            upper.update(l, u+1, u);
            j++;
        }

        // cout << i << endl;
        // REP(i,n) cout << upper.query(i, i+1) << " ";
        // cout << endl;

        bool ok = false;
        int s = qry[i].second.first;
        int t = qry[i].second.second;
        if (t <= s) ok = true;
        else{
            ok = (upper.query(s, s+1) >= t);
        }
        ans[qry[i].first.second] = ok;
    }

    REP(i,q){
        if (ans[i]) printf("Yes\n");
        else printf("No\n");
    }

    return 0;
}

```