#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int a, b;
  scanf("%lld", &a);
  scanf("%lld", &b);
  if (a == b) {
    cout << "0\n";
    return;
  }
  long long int a1 = min(a, b);
  long long int b1 = max(a, b);
  if (b1 % a1 != 0) {
    cout << "-1\n";
    return;
  }
  long long int pdt = (b1 / a1), ans = 0;
  while (pdt % 8 == 0) {
    ans++;
    pdt /= 8;
  }
  while (pdt % 4 == 0) {
    ans++;
    pdt /= 4;
  }
  while (pdt % 2 == 0) {
    ans++;
    pdt /= 2;
  }
  if (pdt != 1)
    cout << "-1\n";
  else
    cout << ans << "\n";
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}
