#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    long long int a, b;
    cin >> a >> b;
    if (a == b) {
      cout << 0 << endl;
      continue;
    }
    if (a > b) {
      long long int t = a;
      a = b;
      b = t;
    }
    if (b % a != 0) {
      cout << -1 << endl;
      continue;
    }
    long long int c = b / a;
    long long int x = 0, z = c;
    while (z % 2 == 0) {
      x++;
      z = z / 2;
    }
    if (z != 1) {
      cout << -1 << endl;
      continue;
    }
    int cnt = 0;
    while (x > 2) {
      cnt++;
      x = x - 3;
    }
    while (x > 1) {
      cnt++;
      x = x - 2;
    }
    while (x > 0) {
      cnt++;
      x = x - 1;
    }
    cout << cnt << endl;
  }
  return 0;
}
