#include <bits/stdc++.h>
using namespace std;
int main() {
  long long tc;
  cin >> tc;
  while (tc--) {
    long long a, b;
    cin >> a >> b;
    long long ans = 0;
    long long mi = min(a, b);
    long long ma = max(a, b);
    a = mi;
    b = ma;
    while (a != b && ans != -1) {
      long long d = b / a;
      if (d < 2)
        ans = -1;
      else if (d >= 8 && (b / 8) * 8 == b) {
        b /= 8;
        ans++;
      } else if (d >= 4 && (b / 4) * 4 == b) {
        b /= 4;
        ans++;
      } else if (d >= 2 && (b / 2) * 2 == b) {
        b /= 2;
        ans++;
      } else
        ans = -1;
    }
    cout << ans << endl;
  }
  return 0;
}
