#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }


/*
 <url:>
 問題文============================================================
 
 =================================================================
 
 解説=============================================================
 
 ================================================================
 */

/*starry sky tree
 add(O(logN)):区間[a, b)に値xを加算する
 getMin(O(logN)): 区間の最小値を得る
 */

static const int MAX_SIZE = 1 << 20;
//typedef long long ll;
ll segMin[2 * MAX_SIZE - 1], segAdd[2 * MAX_SIZE - 1];

void add(ll a,ll b, int x, int k = 0, int l = 0, int r = MAX_SIZE){
    if (r <= a || b <= l) return; //もし交差しない区間であれば終える.
    if (a <= l && r <= b){ //もし今みている区間[l, r)が[a, b)に完全に内包されていれば
        segAdd[k] += x;  //区間[l, r)にkを加算する.
        return;
    }
    
    //子の区間に(必要があれば)xを加算する.
    add(a, b, x, k * 2 + 1, l, (l + r) / 2);
    add(a, b, x, k * 2 + 2, (l + r) / 2, r);
    
    //親の区間の最小値は, 子の区間の最小値 + 自分に一様に加算されている値 である.一様に加算される値は更新しなくて良い.
    segMin[k] = min(segMin[k * 2 + 1] + segAdd[k * 2 + 1], segMin[k * 2 + 2] + segAdd[k * 2 + 2]);
}

ll getMin(ll a, ll b, int k = 0, int l = 0, int r = MAX_SIZE){
    if (r <= a || b <= l) return (LLONG_MAX);
    if (a <= l && r <= b) return (segMin[k] + segAdd[k]); //完全に内包されていれば,その区間の最小値を返す.
    
    ll left = getMin(a, b, k * 2 + 1, l, (l + r) / 2); //子の区間の最小値を求める.
    ll right = getMin(a, b, k * 2 + 2, (l + r) / 2, r); //子の区間の最小値を求める
    
    //親の区間の最小値は, 子の区間の最小値 + 自分に一様に加算されている値 である (大切なので2回書きました!!)
    return (min(left, right) + segAdd[k]);
    
}

typedef pair<pll,pair<pll,int>> event; // { {t , 開通 1 : query 0}{{l,r},順番}}

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll N,M,Q; cin >> N >> M >> Q;
    vector<event> e;
    for(int i = 0; i < M;i++){
        ll d,a,b; cin >> d >> a >> b;
        e.push_back({{d,1},{{2*a,2*b},INF}});
    }
    for(int i = 0; i < Q;i++){
        ll d,s,t; cin >> d >> s >> t;
        e.push_back({{d,0},{{2*s,2*t},i}});
    }
    
    sort(e.begin(),e.end());
    //    cout << e << endl;
    
    vector<ll> ans(Q,0);
    for(int i = 0; i < e.size();i++){
        ll s,t;
        tie(s,t) = e[i].second.first;
        if(e[i].first.second == 0){
            if(s >= t){
                ans[e[i].second.second] = 1;
            }else{
                ans[e[i].second.second] = getMin(s-1,t);
            }
        }else{
            add(s-1,t,1);
//            add(e[i].second.first.first-1,e[i].second.first.second,1);
        }
    }
    for(auto v:ans){
        if(v == 0){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }
    
    return 0;
}


### Prompt

Please provide a cpp coded solution 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 "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }


/*
 <url:>
 問題文============================================================
 
 =================================================================
 
 解説=============================================================
 
 ================================================================
 */

/*starry sky tree
 add(O(logN)):区間[a, b)に値xを加算する
 getMin(O(logN)): 区間の最小値を得る
 */

static const int MAX_SIZE = 1 << 20;
//typedef long long ll;
ll segMin[2 * MAX_SIZE - 1], segAdd[2 * MAX_SIZE - 1];

void add(ll a,ll b, int x, int k = 0, int l = 0, int r = MAX_SIZE){
    if (r <= a || b <= l) return; //もし交差しない区間であれば終える.
    if (a <= l && r <= b){ //もし今みている区間[l, r)が[a, b)に完全に内包されていれば
        segAdd[k] += x;  //区間[l, r)にkを加算する.
        return;
    }
    
    //子の区間に(必要があれば)xを加算する.
    add(a, b, x, k * 2 + 1, l, (l + r) / 2);
    add(a, b, x, k * 2 + 2, (l + r) / 2, r);
    
    //親の区間の最小値は, 子の区間の最小値 + 自分に一様に加算されている値 である.一様に加算される値は更新しなくて良い.
    segMin[k] = min(segMin[k * 2 + 1] + segAdd[k * 2 + 1], segMin[k * 2 + 2] + segAdd[k * 2 + 2]);
}

ll getMin(ll a, ll b, int k = 0, int l = 0, int r = MAX_SIZE){
    if (r <= a || b <= l) return (LLONG_MAX);
    if (a <= l && r <= b) return (segMin[k] + segAdd[k]); //完全に内包されていれば,その区間の最小値を返す.
    
    ll left = getMin(a, b, k * 2 + 1, l, (l + r) / 2); //子の区間の最小値を求める.
    ll right = getMin(a, b, k * 2 + 2, (l + r) / 2, r); //子の区間の最小値を求める
    
    //親の区間の最小値は, 子の区間の最小値 + 自分に一様に加算されている値 である (大切なので2回書きました!!)
    return (min(left, right) + segAdd[k]);
    
}

typedef pair<pll,pair<pll,int>> event; // { {t , 開通 1 : query 0}{{l,r},順番}}

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll N,M,Q; cin >> N >> M >> Q;
    vector<event> e;
    for(int i = 0; i < M;i++){
        ll d,a,b; cin >> d >> a >> b;
        e.push_back({{d,1},{{2*a,2*b},INF}});
    }
    for(int i = 0; i < Q;i++){
        ll d,s,t; cin >> d >> s >> t;
        e.push_back({{d,0},{{2*s,2*t},i}});
    }
    
    sort(e.begin(),e.end());
    //    cout << e << endl;
    
    vector<ll> ans(Q,0);
    for(int i = 0; i < e.size();i++){
        ll s,t;
        tie(s,t) = e[i].second.first;
        if(e[i].first.second == 0){
            if(s >= t){
                ans[e[i].second.second] = 1;
            }else{
                ans[e[i].second.second] = getMin(s-1,t);
            }
        }else{
            add(s-1,t,1);
//            add(e[i].second.first.first-1,e[i].second.first.second,1);
        }
    }
    for(auto v:ans){
        if(v == 0){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }
    
    return 0;
}


```