#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using node = tuple<int,int,int,int>;
const int MAX_N = (1 << 21) - 1;
const ll inf = numeric_limits<ll>::max()/3;


ll seg_add[MAX_N];
ll seg_min[MAX_N];
int res[MAX_N];

// call init(0,0,n) to init
// node k => [l,r)
void init(int k,int l,int r){
  if(r - l == 1){
    seg_add[k] = 0; // init leaf
    seg_min[k] = 0;
  }else{
    int chl = k*2+1;
    int chr = k*2+2;
    seg_add[k] = 0; // init internal-node
    seg_min[k] = 0;
    init(chl, l, (l+r)/2);
    init(chr, (l+r)/2, r);
  }
}

// call add(a,b,x,0,0,n) to add
// node k => [l,r)
void add(int a,int b,int x,int k,int l, int r){
  // not cross
  if(r <= a || b <= l)return;
  else if(a <= l && r <= b){
    // [a,b) contain [l,r)
    seg_add[k] += x;
  } else{
    // otherwise
    int chl = k*2+1;
    int chr = k*2+2;
    add(a,b,x,chl,l,(l+r)/2);
    add(a,b,x,chr,(l+r)/2,r);
    seg_min[k] = min(seg_min[chl] + seg_add[chl],
                     seg_min[chr] + seg_add[chr]);
  }
}

// call find(a,b,0,0,n) to find min-value in  [a,b)
// node k => [l,r)
ll find(int a,int b,int k,int l,int r){
  if(r <= a || b <= l) return inf;
  else if(a <= l && r <= b){
    // [a,b) contain [l,r)
    return seg_min[k] + seg_add[k];
  } else{
    // otherwise
    int chl = k*2+1;
    int chr = k*2+2;
    ll vl = find(a,b,chl,l,(l+r)/2);
    ll vr = find(a,b,chr,(l+r)/2,r);
    return min(vl,vr) + seg_add[k];
  }
}




int main(void){
  int n,m,q;
  cin >> n >> m >> q;
  vector< node > vec;
  init(0,0,n);
  fill(res,res+MAX_N,0);
  for(int i = 0;i < m;++i){
    int d,a,b;
    cin >> d >> a >> b;
    vec.push_back((node){2*d+1,a,b,-1});
  }
  for(int i = 0;i < q;++i){
    int e,s,t;
    cin >> e >> s >> t;
    vec.push_back((node){2*e,s,t,i});
  }
  sort(vec.begin(),vec.end());
  for(int i = 0;i < (int)vec.size();++i){
    int t,a,b,index;
    tie(t,a,b,index) = vec[i];
    if(index == -1){
      add(a,b,1,0,0,n);
    }else{
      ll calc = find(a,b,0,0,n);
      if(calc == 0){
        res[index] = 0;
      }else{
        res[index] = 1;
      }
    }
  }
  for(int i = 0;i < q;++i){
    if(res[i]){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
  return 0;
}


### Prompt

In cpp, your task is to solve the following 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

### Response

```cpp
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using node = tuple<int,int,int,int>;
const int MAX_N = (1 << 21) - 1;
const ll inf = numeric_limits<ll>::max()/3;


ll seg_add[MAX_N];
ll seg_min[MAX_N];
int res[MAX_N];

// call init(0,0,n) to init
// node k => [l,r)
void init(int k,int l,int r){
  if(r - l == 1){
    seg_add[k] = 0; // init leaf
    seg_min[k] = 0;
  }else{
    int chl = k*2+1;
    int chr = k*2+2;
    seg_add[k] = 0; // init internal-node
    seg_min[k] = 0;
    init(chl, l, (l+r)/2);
    init(chr, (l+r)/2, r);
  }
}

// call add(a,b,x,0,0,n) to add
// node k => [l,r)
void add(int a,int b,int x,int k,int l, int r){
  // not cross
  if(r <= a || b <= l)return;
  else if(a <= l && r <= b){
    // [a,b) contain [l,r)
    seg_add[k] += x;
  } else{
    // otherwise
    int chl = k*2+1;
    int chr = k*2+2;
    add(a,b,x,chl,l,(l+r)/2);
    add(a,b,x,chr,(l+r)/2,r);
    seg_min[k] = min(seg_min[chl] + seg_add[chl],
                     seg_min[chr] + seg_add[chr]);
  }
}

// call find(a,b,0,0,n) to find min-value in  [a,b)
// node k => [l,r)
ll find(int a,int b,int k,int l,int r){
  if(r <= a || b <= l) return inf;
  else if(a <= l && r <= b){
    // [a,b) contain [l,r)
    return seg_min[k] + seg_add[k];
  } else{
    // otherwise
    int chl = k*2+1;
    int chr = k*2+2;
    ll vl = find(a,b,chl,l,(l+r)/2);
    ll vr = find(a,b,chr,(l+r)/2,r);
    return min(vl,vr) + seg_add[k];
  }
}




int main(void){
  int n,m,q;
  cin >> n >> m >> q;
  vector< node > vec;
  init(0,0,n);
  fill(res,res+MAX_N,0);
  for(int i = 0;i < m;++i){
    int d,a,b;
    cin >> d >> a >> b;
    vec.push_back((node){2*d+1,a,b,-1});
  }
  for(int i = 0;i < q;++i){
    int e,s,t;
    cin >> e >> s >> t;
    vec.push_back((node){2*e,s,t,i});
  }
  sort(vec.begin(),vec.end());
  for(int i = 0;i < (int)vec.size();++i){
    int t,a,b,index;
    tie(t,a,b,index) = vec[i];
    if(index == -1){
      add(a,b,1,0,0,n);
    }else{
      ll calc = find(a,b,0,0,n);
      if(calc == 0){
        res[index] = 0;
      }else{
        res[index] = 1;
      }
    }
  }
  for(int i = 0;i < q;++i){
    if(res[i]){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
  return 0;
}


```