#include <bits/stdc++.h>
using namespace std;
long long mod(long long x) {
  return (((x % 1000000007) + 1000000007) % 1000000007);
}
long long mul(long long x, long long y) { return mod(mod(x) * mod(y)); }
long long add(long long a, long long b) { return mod(mod(a) + mod(b)); }
long long modpow(long long x, long long y) {
  if (y == 0) return 1ll;
  if (y == 1) return mod(x);
  long long res = 1;
  while (y) {
    if (y % 2 == 1) {
      res = mul(res, x);
    }
    x = mul(x, x);
    y /= 2;
  }
  return res;
}
void solve() {
  long long a, b, n;
  long long cnt = 0;
  cin >> a >> b;
  if (a > b) {
    swap(a, b);
  }
  if (b % a == 0) {
    n = b / a;
  } else {
    cout << -1 << "\n";
    return;
  }
  while (n % 8 == 0) {
    cnt++;
    n /= 8;
  }
  while (n % 4 == 0) {
    cnt++;
    n /= 4;
  }
  while (n % 2 == 0) {
    cnt++;
    n /= 2;
  }
  if (n != 1)
    cout << -1 << "\n";
  else
    cout << cnt << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
