#include #include #include #include using namespace std; pair Muchii[400005]; int MuchieIdx = 0; int n; // AIB int AIBUp[100006], AIBDown[100006]; int Up(int x) { int s = 0; while (x) { s += AIBUp[x]; x -= (x & -x); } return s; } int Down(int x) { int s = 0; while (x) { s += AIBDown[x]; x -= (x & -x); } return s; } void UpdateUp(int x, int val) { while(x <= n) { AIBUp[x] += val; x += (x & -x); } } void UpdateDown(int x, int val) { while (x <= n) { AIBDown[x] += val; x += (x & -x); } } void add(int a, int b) { if ( a > b ) { int tmp = a; a = b; b = tmp; } ++MuchieIdx; Muchii[MuchieIdx] = make_pair(a, b); UpdateUp(a, 1); UpdateDown(b, 1); } void remove(int a) { pair Muchie = Muchii[a]; UpdateUp(Muchie.first, -1); UpdateDown(Muchie.second, -1); } bool econex(int a, int b) { if (Up(b) - Up(a-1) == Down(b) - Down(a-1)) return true; else return false; } int main() { // freopen("data.in", "r" ,stdin); // freopen("data.out", "w", stdout); int m; scanf("%d %d", &n, &m); for ( int i = 1; i <= m; i++ ) { int op; scanf("%d", &op); int x, y; if (op == 1) { scanf("%d %d", &x, &y); add(x, y); } if (op == 2) { scanf("%d", &x); remove(x); } if (op == 3) { scanf("%d %d", &x, &y); if (econex(x,y)) printf("YES\n"); else printf("NO\n"); } } return 0; }