#include #define x first #define y second #define pb push_back using namespace std; const int DN=1e5+5; int n,m,ls,ld,poz,type; int aib[DN]; sets; void update(int poz) { while(poz<=n) { aib[poz]^=1; poz+=(poz&(-poz)); } } int query(int poz) { int sum=0; while(poz>0) { sum^=aib[poz]; poz-=(poz&(-poz)); } return sum; } void add(int poz) { update(poz); if(s.find(poz)!=s.end()) s.erase(s.find(poz)); else s.insert(poz); } void solve1() { cin>>ls>>ld; add(ls); if(ld!=n) add(ld+1); } void solve2() { cin>>poz; cout<::iterator it; it=s.upper_bound(poz); ls=1; if(it!=s.begin()) { it--; ls=*it; it++; } ld=n; if(it!=s.end()) { ld=*it; ld--; } cout<>n>>m; while(m--) { cin>>type; if(type==1) solve1(); else solve2(); } }