#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 7;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    if (a == b) {
      cout << 0 << "\n";
      continue;
    }
    long long cnt = 0;
    if (a > b) {
      while ((a % 2 == 0) and a > b) {
        a >>= 1;
        cnt++;
      }
      if (a == b)
        cout << ceil(cnt / 3.0) << "\n";
      else
        cout << -1 << "\n";
    } else {
      while (a < b) {
        a *= 2;
        cnt++;
      }
      if (a == b)
        cout << ceil(cnt / 3.0) << "\n";
      else
        cout << -1 << "\n";
    }
  }
  return 0;
}
