#define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include using namespace std; const ll MAX=1e15; const int MM=32000000; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); vector A; for(int i=3;iMAX/2) break; tmp*=2; } } ll k=1; while(1){ A.push_back(k); if(k>MAX/2) break; k*=2; } sort(ALL(A)); A.erase(unique(ALL(A)),A.end()); int t; cin>>t; while(t--){ ll l,r; cin>>l>>r; cout<<(upper_bound(ALL(A),r)-lower_bound(ALL(A),l))%2<