#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, oo = 1e9 + 10, MOD = 1e9 + 7;
void solve() {
  long long a, b;
  cin >> a >> b;
  if (a > b) {
    long long ans = 0;
    while (b != a) {
      b *= 2;
      ans++;
      if (b > a) {
        cout << "-1\n";
        return;
      }
    }
    int q = 0, q1 = 0;
    if (ans >= 3) {
      long long k = ans / 3;
      k += ans % 3;
      q = ans % 3;
      ans = k;
      q1 = 1;
    }
    if (q >= 2 && q1) {
      ans -= q / 2;
    }
    if (!q1) {
      ans = (ans + 1) / 2;
    }
    cout << ans << "\n";
  } else {
    if (a == b) {
      cout << "0\n";
      return;
    }
    long long ans = 0;
    while (a != b) {
      a *= 2;
      ans++;
      if (a > b) {
        cout << "-1\n";
        return;
      }
    }
    int q = 0, q1 = 0;
    if (ans >= 3) {
      long long k = ans / 3;
      k += ans % 3;
      q = ans % 3;
      ans = k;
      q1 = 1;
    }
    if (q >= 2 && q1) {
      ans -= q / 2;
    }
    if (!q1) {
      ans = (ans + 1) / 2;
    }
    cout << ans << "\n";
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
