#include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

struct SegmentTree {
  vint data;
  vint lazy;
  int sz;
  SegmentTree(int n) {
    sz = 1; while(sz < n) sz *= 2;
    resz(data, 2*sz-1);
    rep(i, sz) data[i+sz-1] = i+1;
    for(int i = sz-2; i >= 0; --i) {
      data[i] = max(data[2*i+1], data[2*i+2]);
    }
    resz(lazy, 2*sz-1, -1);
  }
  void push(int k, int l, int r) {
    if(~lazy[k]) {
      chmax(data[k], lazy[k]);
      if(r-l > 1) {
	chmax(lazy[2*k+1], lazy[k]);
	chmax(lazy[2*k+2], lazy[k]);
      }
      lazy[k] = -1;
    }
  }
  void update(int a, int b, int x, int k, int l, int r) {
    push(k, l, r);
    if(r <= a || b <= l) return;
    if(a <= l && r <= b) {
      chmax(lazy[k], x);
      push(k, l, r);
      return;
    }
    update(a, b, x, 2*k+1, l, (l+r)/2);
    update(a, b, x, 2*k+2, (l+r)/2, r);
    data[k] = max(data[2*k+1], data[2*k+2]);
  }
  void update(int a, int b, int x) {
    update(a, b, x, 0, 0, sz);
  }
  int query(int a, int b, int k, int l, int r) {
    push(k, l, r);
    if(r <= a || b <= l) return -1;
    if(a <= l && r <= b) return data[k];
    int vl = query(a, b, 2*k+1, l, (l+r)/2);
    int vr = query(a, b, 2*k+2, (l+r)/2, r);
    return max(vl, vr);
  }
  int query(int a, int b) {
    return query(a, b, 0, 0, sz);
  }
};

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, m, q;
  cin >> n >> m >> q;
  vint d(m), a(m), b(m);
  rep(i, m) cin >> d[i] >> a[i] >> b[i], --a[i];
  vint e(q), s(q), t(q);
  rep(i, q) cin >> e[i] >> s[i] >> t[i], --s[i];
  vector<Tapris> vec;
  rep(i, m) vec.emplace_back(d[i], 1, a[i], b[i], i);
  rep(i, q) vec.emplace_back(e[i], 0, s[i], t[i], i);
  sort(all(vec));
  SegmentTree seg(n);
  vector<string> ans(q);
  rep(i, vec.size()) {
    int v, w, x, y, z;
    tie(v, w, x, y, z) = vec[i];
    if(w == 0) {
      if(x+1 >= y) {
	ans[z] = "Yes";
	continue;
      }
      int mr = seg.query(x, x+1);
      int tmp = seg.query(x, mr);
      while(mr != tmp) {
	mr = tmp;
	tmp = seg.query(x, mr);
      }
      ans[z] = (mr >= y ? "Yes" : "No");
      seg.update(x, mr, mr);
    } else {
      seg.update(x, y, y);
    }
  }
  rep(i, ans.size()) cout << ans[i] << 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;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

struct SegmentTree {
  vint data;
  vint lazy;
  int sz;
  SegmentTree(int n) {
    sz = 1; while(sz < n) sz *= 2;
    resz(data, 2*sz-1);
    rep(i, sz) data[i+sz-1] = i+1;
    for(int i = sz-2; i >= 0; --i) {
      data[i] = max(data[2*i+1], data[2*i+2]);
    }
    resz(lazy, 2*sz-1, -1);
  }
  void push(int k, int l, int r) {
    if(~lazy[k]) {
      chmax(data[k], lazy[k]);
      if(r-l > 1) {
	chmax(lazy[2*k+1], lazy[k]);
	chmax(lazy[2*k+2], lazy[k]);
      }
      lazy[k] = -1;
    }
  }
  void update(int a, int b, int x, int k, int l, int r) {
    push(k, l, r);
    if(r <= a || b <= l) return;
    if(a <= l && r <= b) {
      chmax(lazy[k], x);
      push(k, l, r);
      return;
    }
    update(a, b, x, 2*k+1, l, (l+r)/2);
    update(a, b, x, 2*k+2, (l+r)/2, r);
    data[k] = max(data[2*k+1], data[2*k+2]);
  }
  void update(int a, int b, int x) {
    update(a, b, x, 0, 0, sz);
  }
  int query(int a, int b, int k, int l, int r) {
    push(k, l, r);
    if(r <= a || b <= l) return -1;
    if(a <= l && r <= b) return data[k];
    int vl = query(a, b, 2*k+1, l, (l+r)/2);
    int vr = query(a, b, 2*k+2, (l+r)/2, r);
    return max(vl, vr);
  }
  int query(int a, int b) {
    return query(a, b, 0, 0, sz);
  }
};

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, m, q;
  cin >> n >> m >> q;
  vint d(m), a(m), b(m);
  rep(i, m) cin >> d[i] >> a[i] >> b[i], --a[i];
  vint e(q), s(q), t(q);
  rep(i, q) cin >> e[i] >> s[i] >> t[i], --s[i];
  vector<Tapris> vec;
  rep(i, m) vec.emplace_back(d[i], 1, a[i], b[i], i);
  rep(i, q) vec.emplace_back(e[i], 0, s[i], t[i], i);
  sort(all(vec));
  SegmentTree seg(n);
  vector<string> ans(q);
  rep(i, vec.size()) {
    int v, w, x, y, z;
    tie(v, w, x, y, z) = vec[i];
    if(w == 0) {
      if(x+1 >= y) {
	ans[z] = "Yes";
	continue;
      }
      int mr = seg.query(x, x+1);
      int tmp = seg.query(x, mr);
      while(mr != tmp) {
	mr = tmp;
	tmp = seg.query(x, mr);
      }
      ans[z] = (mr >= y ? "Yes" : "No");
      seg.update(x, mr, mr);
    } else {
      seg.update(x, y, y);
    }
  }
  rep(i, ans.size()) cout << ans[i] << endl;

  return 0;
}


```