#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  int T;
  cin >> T;
  while (T--) {
    unsigned long long a, b, l = 1, e = 0;
    cin >> a >> b;
    if (a == b)
      cout << "0\n";
    else if (a % b == 0 && __builtin_popcountll(a / b) == 1) {
      l += __builtin_ctzll(a / b);
      for (int i = 4; i < l; i += 3) {
        e++;
      }
      cout << 1 + e << "\n";
    } else if (b % a == 0 && __builtin_popcountll(b / a) == 1) {
      l += __builtin_ctzll(b / a);
      for (int i = 4; i < l; i += 3) {
        e++;
      }
      cout << 1 + e << "\n";
    } else
      cout << "-1\n";
  }
  return 0;
}
