#include <bits/stdc++.h>
using namespace std;
int main() {
  auto gucciGang = []() {
    std::ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return 0;
  }();
  int t;
  cin >> t;
  while (t--) {
    long long int a, b;
    cin >> a >> b;
    if (a == b) {
      cout << 0 << "\n";
    } else {
      long long int x;
      long long int max_e = max(a, b);
      long long int min_e = min(a, b);
      if (max_e % min_e) {
        cout << -1 << "\n";
      } else {
        x = max_e / min_e;
        int count = 0;
        while (!(x & 1)) {
          count++;
          x = x >> 1;
        }
        if (x == 1) {
          int z = (count / 3);
          if ((count % 3)) {
            z++;
          }
          cout << z << "\n";
        } else {
          cout << -1 << "\n";
        }
      }
    }
  }
  return 0;
}
