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