#include <bits/stdc++.h>
using namespace std;
map<long long, int> check;
int main() {
  for (int i = 0; i <= 64; i++) check[1ll << i] = 1;
  int t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    long long ans = 0;
    while (a < b) {
      if (a * 8 <= b)
        a *= 8, ans++;
      else if (a * 4 <= b)
        a *= 4, ans++;
      else if (a * 2 <= b)
        a *= 2, ans++;
      else
        break;
    }
    cout << (a == b ? ans : -1) << "\n";
  }
  return 0;
}
