#include #include using namespace std; set S; int AIB[100005]; int N,M; void u(int pos) { for(;pos<=N;pos+=(-pos)&pos) AIB[pos]^=1; } int q(int pos) { int nr=0; for(;pos;pos-=(-pos)&pos) nr^=AIB[pos]; return nr; } int main() { cin.sync_with_stdio(false); cout.sync_with_stdio(false); cin>>N>>M; S.insert(0); S.insert(N+1); for(int i=1;i<=M;i++) { int tip,x,y; cin>>tip; if(tip==1) { cin>>x>>y; u(x);u(y+1); if(S.find(x)!=S.end())S.erase(x); else S.insert(x); if(S.find(y+1)!=S.end())S.erase(y+1); else S.insert(y+1); } else { cin>>x; set::iterator it=S.lower_bound(x); if(*it>x)it--; int st=*it; it++; int dr=*it; cout<