#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long int a, b;
    cin >> a >> b;
    if (a > b) {
      swap(a, b);
    }
    if (a == b) {
      cout << '0' << endl;
      continue;
    }
    if (b % a != 0) {
      cout << "-1" << endl;
      continue;
    }
    long long int div = b / a;
    vector<int> factors;
    while (div % 2 == 0) {
      div /= 2;
      factors.push_back(2);
    }
    if (div != 1) {
      cout << "-1" << endl;
      continue;
    }
    int x = 1;
    long long int cnt = 0;
    for (int i = 0; i < factors.size(); ++i) {
      x *= factors[i];
      if (x == 8) {
        cnt += 1;
        x = 1;
      }
    }
    if (x != 1) cnt += 1;
    cout << cnt << endl;
  }
  return 0;
}
