#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long int t, a, b;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    if (b > a) {
      swap(a, b);
    }
    unsigned long long int n = a / b;
    if (n * b != a) {
      cout << "-1" << endl;
      continue;
    }
    unsigned long long int cnt = 0;
    while (n % 8 == 0) {
      if (n == 0) break;
      n = n / 8;
      ++cnt;
    }
    while (n % 4 == 0) {
      if (n == 0) break;
      n = n / 4;
      ++cnt;
    }
    while (n % 2 == 0) {
      if (n == 0) break;
      n = n / 2;
      ++cnt;
    }
    if (n == 0 || n == 1) {
      cout << cnt << endl;
    } else {
      cout << "-1" << endl;
    }
  }
  return 0;
}
