#include #include #include #include #define pii pair using namespace std; int n, m, rez[2]; vector M; multiset S[2][100100]; int A[2][400100]; inline void Build(int nod, int st, int dr) { if(st == dr) { A[0][nod] = A[1][nod] = st; return; } int mij = (st + dr) / 2; Build(2 * nod, st, mij); Build(2 * nod + 1, mij + 1, dr); A[0][nod] = min(A[0][2 * nod], A[0][2 * nod + 1]); A[1][nod] = max(A[1][2 * nod], A[1][2 * nod + 1]); } inline void Update(int nod, int st, int dr, int x) { if(st == dr) { A[0][nod] = *S[0][x].begin(); A[1][nod] = -*S[1][x].begin(); return; } int mij = (st + dr) / 2; if(x <= mij) Update(2 * nod, st, mij, x); else Update(2 * nod + 1, mij + 1, dr, x); A[0][nod] = min(A[0][2 * nod], A[0][2 * nod + 1]); A[1][nod] = max(A[1][2 * nod], A[1][2 * nod + 1]); } inline void Query(int nod, int st, int dr, int x, int y) { if(x <= st && dr <= y) { rez[0] = min(rez[0], A[0][nod]); rez[1] = max(rez[1], A[1][nod]); return; } int mij = (st + dr) / 2; if(x <= mij) Query(2 * nod, st, mij, x, y); if(mij + 1 <= y) Query(2 * nod + 1, mij + 1, dr, x, y); } int main() { int i, op, x, y, ind; cin >> n >> m; for(i = 1; i <= n; ++i) { S[0][i].insert(i); S[1][i].insert(-i); } Build(1, 1, n); for(i = 1; i <= m; ++i) { cin >> op; if(op == 1) { cin >> x >> y; M.push_back(make_pair(x, y)); S[0][x].insert(y); S[1][x].insert(-y); Update(1, 1, n, x); S[0][y].insert(x); S[1][y].insert(-x); Update(1, 1, n, y); } if(op == 2) { cin >> ind; x = M[ind - 1].first; y = M[ind - 1].second; S[0][x].erase(S[0][x].find(y)); S[1][x].erase(S[1][x].find(-y)); Update(1, 1, n, x); S[0][y].erase(S[0][y].find(x)); S[1][y].erase(S[1][y].find(-x)); Update(1, 1, n, y); } if(op == 3) { cin >> x >> y; rez[0] = n + 1; rez[1] = 0; Query(1, 1, n, x, y); if(x <= rez[0] && rez[1] <= y) cout << "YES\n"; else cout << "NO\n"; } } return 0; }