#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

/* include file*/
#include <functional>
#include <vector>
using namespace std;

template <class Monoid>
struct Segment {
  using Func = function<Monoid(Monoid, Monoid)>;

  vector<Monoid> node;
  Monoid ide;
  int n = 1;

  Func bin_f;
  Func update_f;

  Segment(const vector<Monoid>& init, Monoid ide_, Func f_, Func u_f)
      : bin_f(f_), ide(ide_), update_f(u_f) {
    int sz = init.size();
    while (n < sz)
      n *= 2;
    node.assign(n * 2 - 1, ide);
    for (int i = 0; i < sz; i++)
      node[i + n - 1] = init[i];
    for (int i = n - 2; i >= 0; i--)
      node[i] = bin_f(node[i * 2 + 1], node[i * 2 + 2]);
  }

  void update(int i, Monoid x) {
    i += n - 1;
    node[i] = update_f(node[i], x);
    while (i) {
      i = (i - 1) / 2;
      node[i] = bin_f(node[i * 2 + 1], node[i * 2 + 2]);
    }
  }

  Monoid get_inter(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0)
      r = n;
    if (a <= l && r <= b)
      return node[k];
    if (r <= a || b <= l)
      return ide;

    Monoid lm = get_inter(a, b, k * 2 + 1, l, (l + r) / 2);
    Monoid rm = get_inter(a, b, k * 2 + 2, (l + r) / 2, r);
    return bin_f(lm, rm);
  }
};

// http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2730414#1
// http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2730425#1
typedef long long ll;

struct LazySegment {
  vector<ll> node;
  vector<ll> lazy;
  vector<bool> lazyFlag;
  ll n;

  ll init = 0;

  LazySegment(const vector<ll>& vec) {
    int sz = vec.size();

    n = 1;
    while (n < sz) n <<= 1;

    node.resize(2 * n - 1);
    lazy.resize(2 * n - 1, init);
    lazyFlag.resize(2 * n - 1, false);

    for (int i = 0; i < sz; i++) {
      node[n - 1 + i] = vec[i];
    }

    for (int i = n - 2; i >= 0; i--) {
      node[i] = max(node[2 * i + 1], node[2 * i + 2]);
    }
  }

  void eval(int k, int l, int r) {
    if (lazyFlag[k]) {
      node[k] = max(node[k],lazy[k]);

      if (r - l > 1) {
        lazy[2 * k + 1] = max(lazy[2 * k + 1] , lazy[k]);
        lazy[2 * k + 2] = max(lazy[2 * k + 2] , lazy[k]);
        lazyFlag[2 * k + 1] = true;
        lazyFlag[2 * k + 2] = true;
      }

      lazy[k] = 0;
      lazyFlag[k] = false;
    }
  }

  void add_inter(int a, int b, ll x, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;

    eval(k, l, r);

    if (b <= l || r <= a) return;

    if (a <= l && r <= b) {
      lazy[k] = max(lazy[k],x);
      lazyFlag[k] = true;
      eval(k, l, r);
    }

    else {
      add_inter(a, b, x, 2 * k + 1, l, (l + r) / 2);
      add_inter(a, b, x, 2 * k + 2, (l + r) / 2, r);
      node[k] = max(node[2 * k + 1], node[2 * k + 2]);
    }
  }

  ll get_inter(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;

    eval(k, l, r);
    if (b <= l || r <= a) return init;

    if (a <= l && r <= b) return node[k];

    ll lv = get_inter(a, b, k * 2 + 1, l, (l + r) / 2);
    ll rv = get_inter(a, b, k * 2 + 2, (l + r) / 2, r);

    return max(lv, rv);
  }
};
int n;
int m;
int q;


vector<int> days;

vector<int> d(101010);
vector<int> a(101010);
vector<int> b(101010);

vector<P> D[202020];


vector<int> e(101010);
vector<int> s(101010);
vector<int> t(101010);

int now = 0;


using query  = pair<P,P>;

vector<query> Query;

int main(){
    cin >> n >> m >> q;
    rep(i,0,m - 1){
        cin >> d[i] >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }
    rep(i,0,m - 1) days.push_back(d[i]);
    rep(i,0,q - 1){
        cin >> e[i] >> s[i] >> t[i];
        days.push_back(e[i]);
        s[i]--;
        t[i]--;
    }

    sort(days.begin(),days.end());
    days.erase(unique(days.begin(),days.end()),days.end());

    rep(i,0,m - 1){
        int ite = lower_bound(days.begin(),days.end(),d[i]) - days.begin();
        D[ite].push_back({a[i],b[i]});
    }

    rep(i,0,q - 1){
        int ite = lower_bound(days.begin(),days.end(),e[i]) - days.begin();
        Query.push_back({{ite,s[i]},{t[i],i}});
    }

    vector<int> vec;
    for(int i  = 0;i < n;i++){
        vec.push_back(i);
    }
    Segment<int> seg(vec,0,[](int a,int b){return max(a,b);} , [](int node,int x){return max(node,x);});
    vector<string> ans(q);
    sort(Query.begin(),Query.end());
    int now = 0;
    for(int i = 0;i < q;i++){
        int Q = Query[i].first.first;
        for(;now < Q;now++){
            for(auto& v : D[now]){
                seg.update(v.first,v.second);
            }
        }
        int temp;
        int point = Query[i].first.second;
        while((temp = seg.get_inter(0,point + 1)) > point){point = temp;}
        if(point >= Query[i].second.first){
            ans[Query[i].second.second] = "Yes";
        }
        else{
            ans[Query[i].second.second] = "No";
        }
    }

    for(string an : ans){
        cout << an << endl;
    }
}



### Prompt

Your task is to create a CPP solution to 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 <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

/* include file*/
#include <functional>
#include <vector>
using namespace std;

template <class Monoid>
struct Segment {
  using Func = function<Monoid(Monoid, Monoid)>;

  vector<Monoid> node;
  Monoid ide;
  int n = 1;

  Func bin_f;
  Func update_f;

  Segment(const vector<Monoid>& init, Monoid ide_, Func f_, Func u_f)
      : bin_f(f_), ide(ide_), update_f(u_f) {
    int sz = init.size();
    while (n < sz)
      n *= 2;
    node.assign(n * 2 - 1, ide);
    for (int i = 0; i < sz; i++)
      node[i + n - 1] = init[i];
    for (int i = n - 2; i >= 0; i--)
      node[i] = bin_f(node[i * 2 + 1], node[i * 2 + 2]);
  }

  void update(int i, Monoid x) {
    i += n - 1;
    node[i] = update_f(node[i], x);
    while (i) {
      i = (i - 1) / 2;
      node[i] = bin_f(node[i * 2 + 1], node[i * 2 + 2]);
    }
  }

  Monoid get_inter(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0)
      r = n;
    if (a <= l && r <= b)
      return node[k];
    if (r <= a || b <= l)
      return ide;

    Monoid lm = get_inter(a, b, k * 2 + 1, l, (l + r) / 2);
    Monoid rm = get_inter(a, b, k * 2 + 2, (l + r) / 2, r);
    return bin_f(lm, rm);
  }
};

// http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2730414#1
// http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2730425#1
typedef long long ll;

struct LazySegment {
  vector<ll> node;
  vector<ll> lazy;
  vector<bool> lazyFlag;
  ll n;

  ll init = 0;

  LazySegment(const vector<ll>& vec) {
    int sz = vec.size();

    n = 1;
    while (n < sz) n <<= 1;

    node.resize(2 * n - 1);
    lazy.resize(2 * n - 1, init);
    lazyFlag.resize(2 * n - 1, false);

    for (int i = 0; i < sz; i++) {
      node[n - 1 + i] = vec[i];
    }

    for (int i = n - 2; i >= 0; i--) {
      node[i] = max(node[2 * i + 1], node[2 * i + 2]);
    }
  }

  void eval(int k, int l, int r) {
    if (lazyFlag[k]) {
      node[k] = max(node[k],lazy[k]);

      if (r - l > 1) {
        lazy[2 * k + 1] = max(lazy[2 * k + 1] , lazy[k]);
        lazy[2 * k + 2] = max(lazy[2 * k + 2] , lazy[k]);
        lazyFlag[2 * k + 1] = true;
        lazyFlag[2 * k + 2] = true;
      }

      lazy[k] = 0;
      lazyFlag[k] = false;
    }
  }

  void add_inter(int a, int b, ll x, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;

    eval(k, l, r);

    if (b <= l || r <= a) return;

    if (a <= l && r <= b) {
      lazy[k] = max(lazy[k],x);
      lazyFlag[k] = true;
      eval(k, l, r);
    }

    else {
      add_inter(a, b, x, 2 * k + 1, l, (l + r) / 2);
      add_inter(a, b, x, 2 * k + 2, (l + r) / 2, r);
      node[k] = max(node[2 * k + 1], node[2 * k + 2]);
    }
  }

  ll get_inter(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;

    eval(k, l, r);
    if (b <= l || r <= a) return init;

    if (a <= l && r <= b) return node[k];

    ll lv = get_inter(a, b, k * 2 + 1, l, (l + r) / 2);
    ll rv = get_inter(a, b, k * 2 + 2, (l + r) / 2, r);

    return max(lv, rv);
  }
};
int n;
int m;
int q;


vector<int> days;

vector<int> d(101010);
vector<int> a(101010);
vector<int> b(101010);

vector<P> D[202020];


vector<int> e(101010);
vector<int> s(101010);
vector<int> t(101010);

int now = 0;


using query  = pair<P,P>;

vector<query> Query;

int main(){
    cin >> n >> m >> q;
    rep(i,0,m - 1){
        cin >> d[i] >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }
    rep(i,0,m - 1) days.push_back(d[i]);
    rep(i,0,q - 1){
        cin >> e[i] >> s[i] >> t[i];
        days.push_back(e[i]);
        s[i]--;
        t[i]--;
    }

    sort(days.begin(),days.end());
    days.erase(unique(days.begin(),days.end()),days.end());

    rep(i,0,m - 1){
        int ite = lower_bound(days.begin(),days.end(),d[i]) - days.begin();
        D[ite].push_back({a[i],b[i]});
    }

    rep(i,0,q - 1){
        int ite = lower_bound(days.begin(),days.end(),e[i]) - days.begin();
        Query.push_back({{ite,s[i]},{t[i],i}});
    }

    vector<int> vec;
    for(int i  = 0;i < n;i++){
        vec.push_back(i);
    }
    Segment<int> seg(vec,0,[](int a,int b){return max(a,b);} , [](int node,int x){return max(node,x);});
    vector<string> ans(q);
    sort(Query.begin(),Query.end());
    int now = 0;
    for(int i = 0;i < q;i++){
        int Q = Query[i].first.first;
        for(;now < Q;now++){
            for(auto& v : D[now]){
                seg.update(v.first,v.second);
            }
        }
        int temp;
        int point = Query[i].first.second;
        while((temp = seg.get_inter(0,point + 1)) > point){point = temp;}
        if(point >= Query[i].second.first){
            ans[Query[i].second.second] = "Yes";
        }
        else{
            ans[Query[i].second.second] = "No";
        }
    }

    for(string an : ans){
        cout << an << endl;
    }
}



```