#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int a, b;
    cin >> a >> b;
    int ta = 0;
    int tb = 0;
    long long int aa, bb;
    aa = a;
    bb = b;
    while (aa % 2 == 0) {
      ta++;
      aa /= 2;
    }
    while (bb % 2 == 0) {
      tb++;
      bb /= 2;
    }
    if (bb != aa) {
      cout << -1 << endl;
    } else {
      int diff = abs(tb - ta);
      int ct = 0;
      while (diff > 0) {
        if (diff - 3 >= 0) {
          diff -= 3;
          ct++;
        } else if (diff - 2 >= 0) {
          diff -= 2;
          ct++;
        } else {
          diff--;
          ct++;
        }
      }
      cout << ct << endl;
    }
  }
  return 0;
};
