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

Solution (in CPP):

Solution:
#include <algorithm>
#include <iostream>
#include <vector>
#include <functional>
#include <utility>

template <typename T, typename E>
struct LazySegmentTree{
private:
  using F = std::function<T(T,T)>;
  using G = std::function<T(T,E)>;
  using H = std::function<E(E,E)>;
  int n, height;
  F f;
  G g;
  H h;
  T ti;
  E ei;
  std::vector<T> dat;
  std::vector<E> laz;
  T reflect(int k){
    return laz[k] == ei ? dat[k] : g(dat[k],laz[k]);
  }
  void propagate(int k){
    if(laz[k] == ei) return;
    if(k >= n){
      dat[k] = reflect(k);
      laz[k] = ei;
      return;
    }
    laz[k<<1|0] = h(laz[k<<1|0],laz[k]);
    laz[k<<1|1] = h(laz[k<<1|1],laz[k]);
    dat[k] = reflect(k);
    laz[k] = ei;
  }
  void thrust(int k){
    for(int i = height; i >= 0; --i)
      propagate(k>>i);
  }
  void recalc(int k){
    while(k >>= 1){
      dat[k] = f(reflect(k<<1|0),reflect(k<<1|1));
    }
  }
public:
  LazySegmentTree(F f,G g, H h, T ti, E ei) :
    f(f), g(g), h(h), ti(ti), ei(ei) {}
  void build(int n_){
    n = n_;
    height = 2;
    while(n_ >>= 1) ++height;
    dat.assign(2*n,ti);
    laz.assign(2*n,ei);
  }
  void build(const std::vector<T> &v){
    int n_ = v.size();
    build(n_);
    for(int i = 0; i < n; ++i) dat[n+i]=v[i];
    for(int i = n-1; i >= 0; --i)
      dat[i]=f(dat[i<<1|0],dat[i<<1|1]);
  }
  void update(int l_, int r_, E x){
    if(l_ >= r_) return;
    l_ += n, r_ += n;
    thrust(l_);
    thrust(r_-1);
    for(int l = l_, r = r_;l < r; l >>= 1, r >>= 1){
      if(l&1) laz[l] = h(laz[l],x), ++l;
      if(r&1) --r, laz[r] = h(laz[r],x);
    }
    recalc(l_);
    recalc(r_-1);
  }
  void set_val(int a, T x){
    thrust(a+=n);
    dat[a] = x;
    laz[a] = ei;
    recalc(a);
  }
  T query(int l, int r){
    if(l >= r) return ti;
    l += n;
    r += n;
    thrust(l);
    thrust(r-1);
    T vl = ti, vr = ti;
    for(; l < r; l >>= 1, r >>= 1){
      if(l&1) vl = f(vl,reflect(l++));
      if(r&1) vr = f(reflect(--r),vr);
    }
    return f(vl,vr);
  }
};


#include <algorithm>
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;

int main(){
  int N, M, Q;
  cin >> N >> M >> Q;
  vector<int> D(M), A(M), B(M), E(Q), S(Q), T(Q);
  for(int i = 0; i < M; ++i)
    cin >> D[i] >> A[i] >> B[i];
  for(int i = 0; i < Q; ++i)
    cin >> E[i] >> S[i] >> T[i];

  function<int(int,int)> f = [](int a, int b){return min(a,b);};
  function<int(int,int)> g = [](int a, int b){return a+b;};
  const int INF = 1e9;
  LazySegmentTree<int,int> st(f,g,g,INF,0);
  vector<int> ini(N+1);
  st.build(ini);

  vector<int> P(M);
  iota(P.begin(), P.end(), 0);
  sort(P.begin(), P.end(), [&](int a, int b){return D[a] < D[b];});
  vector<int> query(Q);
  iota(query.begin(), query.end(), 0);
  sort(query.begin(), query.end(), [&](int a, int b){return E[a] < E[b];});
  vector<bool> ans(Q);
  int j = 0;
  for(auto q : query){
    int e = E[q], s = S[q], t = T[q];
    while(j < M and D[P[j]] < e){
      int p = P[j];
      ++j;
      int a = A[p], b = B[p];
      st.update(a,b,1);
    }
    if(s >= t){
      ans[q] = true;
      continue;
    }
    if(st.query(s,t) > 0){
      ans[q] = true;
    }else{
      ans[q] = false;
    }
  }
  for(auto e : ans)
    cout << (e ? "Yes\n" : "No\n");
}