#include #include #include using namespace std; ifstream f ("date.in"); int n, m; vector v[100001]; struct muchie { int a, b; }; vector muchii; void citeste () { f>>n>>m; } int check (int a, int b) { int l = v[a].size (); for (int i = 0; i < l; i++) { if (v[a][i] < a) return 0; if (v[a][i] >= b) return 0; } l = v[b].size (); for (int i = 0; i < l; i++) { if (v[b][i] < a) return 0; if (v[b][i] > b) return 0; } return 1; } void rezolva () { int x, a, b; for (int i=1; i<=m; i++) { f>>x; if (x==1) { f>>a>>b; v[a].push_back (b); v[b].push_back (a); muchie y; y.a = a; y.b = b; muchii.push_back (y); } if (x==2) { f>>a; int x, y; x = muchii[a].a; y = muchii[a].b; for (int i = 0; i < v[x].size (); i++) if (v[x][i] == y) v[x].erase (v[x].begin () + i - 1); for (int i = 0; i < v[y].size (); i++) if (v[y][i] == x) v[y].erase (v[y].begin () + i - 1); muchii.erase (muchii.begin () + a - 1); } if (x==3) { f>>a>>b; if (check (a, b)) cout<<"YES"; else cout<<"NO"; cout << endl; } } } int main () { citeste (); rezolva (); return 0; }