#include <bits/stdc++.h>
using namespace std;
inline long long toint(const std::string &s) {
  std::stringstream ss;
  ss << s;
  long long x;
  ss >> x;
  return x;
}
inline std::string tostring(long long number) {
  std::stringstream ss;
  ss << number;
  return ss.str();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  for (long long int tt = 0; tt < t; tt++) {
    long long int a, b;
    cin >> a >> b;
    if (b == a) {
      cout << '0' << "\n";
      continue;
    }
    if (b < a) {
      swap(a, b);
    }
    long long int cnt = 0, f = 0;
    if (b > a) {
      if (b % a != 0) {
        cout << "-1"
             << "\n";
        continue;
        f = 1;
      } else {
        long long int x = b / a;
        while (x != 1) {
          if (x % 8 == 0) {
            x /= 8;
            cnt++;
          } else if (x % 4 == 0) {
            x /= 4;
            cnt++;
          } else if (x % 2 == 0) {
            x /= 2;
            cnt++;
          } else {
            cout << "-1"
                 << "\n";
            f = 1;
            break;
          }
        }
      }
      if (!f) cout << cnt << "\n";
    }
  }
  return 0;
}
