#include #include using namespace atcoder; using namespace std; using ll=long long; using mint=modint998244353; const int b=400; using ar=array; int d,w; ar op(ar x,ar y){ x[0]=min(x[0],y[0]); x[1]=min(x[1],y[1]); x[2]=min(x[2],y[2]); return x; } ar e(){ return ar({(int)1e9,(int)1e9,(int)1e9}); } bool F(ar x){ return x[w]>=d; } int main() { int n; cin>>n; vector a(n); for(int i=0;i>a[i]; for(int i=0;i> stv((n+b-1)/b); stv[0]=segtree(vector(n+1,{-1,-1,-1})); for(int i=1;i<(n+b-1)/b;i++){ stv[i]=stv[i-1]; for(int j=(i-1)*b;j>q; while(q--){ ll x,y; cin>>x>>y; x^=key;y^=key; x--; int p=y/b; vector> rec; set s; for(int i=p*b;i(0)),y-x-2); } cout<