#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
int main() {
  ll t;
  cin >> t;
  for (ll i = 0; i < t; i++) {
    ll a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    ll ope = 0;
    while (a < b && b % 2 == 0) {
      b /= 2;
      ope++;
    }
    if (a == b) {
      cout << (ope + 2) / 3 << endl;
    } else {
      cout << -1 << endl;
    }
  }
}
