#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long a, b;
  cin >> a >> b;
  if (b > a) swap(a, b);
  if (a % b != 0) {
    cout << "-1";
    return;
  }
  if (a == b) {
    cout << "0";
    return;
  }
  long long c = a / b, ans = 0;
  while (c % 8 == 0) {
    ans++;
    c /= 8;
  }
  while (c % 4 == 0) {
    ans++;
    c /= 4;
  }
  while (c % 2 == 0) {
    ans++;
    c /= 2;
  }
  if (c == 1) {
    cout << ans;
    return;
  } else
    cout << "-1";
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    solve();
    cout << endl;
  }
}
