#include <bits/stdc++.h>
using namespace std;
const long int m = 1000000007;
int prsb(long long int n) {
  int pos = 0;
  long long int m = 1;
  while (!(n & m)) {
    m = m << 1;
    pos++;
  }
  return pos;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int a, b;
    cin >> a >> b;
    long long int x, y, z;
    int n, c = 0;
    x = min(a, b);
    y = max(a, b);
    z = y / x;
    if (y % x != 0) {
      c = -1;
    } else if (z == 1) {
      c = 0;
    } else if (z && (!(z & (z - 1)))) {
      n = prsb(z);
      c += n / 3;
      n = n % 3;
      c += n / 2;
      n = n % 2;
      c += n / 1;
    } else {
      c = -1;
    }
    cout << c << endl;
  }
}
