#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long solve() {
  long long a, b;
  cin >> a >> b;
  long long temp = a;
  a = min(a, b);
  b = max(temp, b);
  if ((b % a) != 0 || !(b / a)) return -1;
  long long n = b / a;
  long long count = 0;
  while (n > 1) {
    if (n % 8 == 0) {
      count++;
      n /= 8;
    } else if (n % 4 == 0) {
      count++;
      n /= 4;
    } else if (n % 2 == 0) {
      count++;
      n /= 2;
    } else
      return -1;
  }
  return count;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    cout << solve() << endl;
  }
  return 0;
}
