#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long binpow(long long a, long long b) {
  a %= mod;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % mod;
    res = res * res % mod;
    b >>= 1;
  }
  return res;
}
int gcd(int a, int b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
int extgcd(int a, int b, int& x, int& y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  int x1, y1;
  int d = extgcd(b, a % b, x1, y1);
  x = y1;
  y = x1 - y1 * (a / b);
  return d;
}
const int MxN = 1000000;
int lp[MxN + 1];
vector<int> primes;
void cal_primes() {
  for (int i = 2; i <= MxN; ++i) {
    if (lp[i] == 0) {
      lp[i] = i;
      primes.push_back(i);
    }
    for (int j = 0;
         j < (int)primes.size() && primes[j] <= lp[i] && i * primes[j] <= MxN;
         ++j) {
      lp[i * primes[j]] = primes[j];
    }
  }
}
void solve() {
  long long a, b;
  cin >> a >> b;
  if (a == b) {
    cout << 0 << endl;
    return;
  }
  if (a > b) {
    swap(a, b);
  }
  int count = 0;
  while (a < b) {
    if (a * 8 == b) {
      cout << count + 1 << endl;
      return;
    } else if (a * 4 == b) {
      cout << count + 1 << endl;
      return;
    } else if (a * 2 == b) {
      cout << count + 1 << endl;
      return;
    }
    if (a * 2 < b) {
      a *= 2;
      if (a * 2 < b) {
        a *= 2;
        if (a * 2 < b) {
          a *= 2;
        } else
          break;
      } else
        break;
    } else
      break;
    count++;
  }
  cout << -1 << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
