#include <iostream>
using namespace std;
int main() {
int T;cin>>T;
for(int i=0;i<T;i++)
{
long long x,y;cin>>x>>y;
int ans = 0;
while((x|y)!=y)
{
x>>=1;
ans++;
}
if(x!=y) ans++;
cout<<ans<<endl;
}
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号