#include <bits/stdc++.h>
using namespace std;
long long mod(long long x) {
  return ((x % 1000000007 + 1000000007) % 1000000007);
}
long long add(long long a, long long b) { return mod(mod(a) + mod(b)); }
long long mul(long long a, long long b) { return mod(mod(a) * mod(b)); }
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    if (a < b) {
      long long t = a;
      a = b;
      b = t;
    }
    if (a < b) {
      int count = 0;
      while (a < b) {
        long long val1 = a << 3;
        long long val2 = a << 2;
        long long val3 = a << 1;
        if ((val1) <= b) {
          a = a << 3;
          count++;
        } else if ((val2) <= b) {
          a = a << 2;
          count++;
        } else if ((val3) <= b) {
          a = a << 1;
          count++;
        } else {
          break;
        }
      }
      if (a == b)
        cout << count << endl;
      else
        cout << -1 << endl;
    } else if (a > b) {
      int count = 0;
      while (a > b) {
        if ((a % 8 == 0) and (a / 8) >= b) {
          a = a / 8;
          count++;
        } else if ((a % 4 == 0) and (a / 4) >= b) {
          a = a / 4;
          count++;
        } else if ((a % 2 == 0) and (a / 2) >= b) {
          a = a / 2;
          count++;
        } else {
          break;
        }
      }
      if (a == b) {
        cout << count << endl;
      } else {
        cout << -1 << endl;
      }
    } else {
      cout << 0 << endl;
    }
  }
  return 0;
}
