#include #include using namespace std; using namespace atcoder; using llong = long long; using ldbl = long double; using p = pair; #define ALL(x) x.begin(), x.end() constexpr llong mod = 1e9+7; constexpr llong inf = mod * mod; struct S { int a; }; struct F { int a; }; S op(S l, S r) { return S{min(l.a, r.a)}; } S e() { return S{0}; } S mapping(F l, S r) { return S{r.a + l.a}; } F composition(F l, F r) { return F{r.a + l.a}; } F id() { return F{0}; } struct node { string x; int l; int r; }; struct query { int id; int t; node xlr; }; map zaatsu; int z(int x) { return zaatsu[x]; } int main() { int n, q; vector xlr; vector que; set t; cin >> n; xlr.resize(n); for (auto &[x, l, r]: xlr) { cin >> x >> l >> r; t.insert(l); t.insert(r); t.insert(l + 1); t.insert(r + 1); } cin >> q; que.resize(q); for (auto &[id, ti, xlr]: que) { cin >> id; if (id == 1) { cin >> xlr.x >> ti; } else if (id == 2) { cin >> ti; } else if (id == 3) { cin >> xlr.x >> xlr.l >> xlr.r; } t.insert(ti); t.insert(xlr.l); t.insert(xlr.r); t.insert(ti + 1); t.insert(xlr.l + 1); t.insert(xlr.r + 1); } for (auto s: t) { zaatsu[s] = zaatsu.size(); } map> st; lazy_segtree seg(zaatsu.size() + 1); xlr.resize(n); for (auto &[x, l, r]: xlr) { st[x].insert(p(z(r), z(l))); seg.apply(z(l), z(r + 1), F{1}); } for (auto [key, val]: zaatsu) { cerr << key << " " << val << endl; } for (auto &[id, ti, xlr]: que) { auto [x, l, r] = xlr; if (id == 1) { auto it = st[x].lower_bound(p(z(ti), 0)); if (it == st[x].end()) { cout << "No" << endl; } else { cout << (it->second <= z(ti) ? "Yes": "No") << endl; } } else if (id == 2) { cout << seg.get(z(ti)).a << endl; } else if (id == 3) { st[x].insert(p(z(r), z(l))); seg.apply(z(l), z(r + 1), F{1}); } } return 0; }