#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(NULL);
  cin.tie(NULL);
  int t;
  long long a, b, count;
  cin >> t;
  while (t > 0) {
    cin >> a >> b;
    count = 0;
    if (a == b)
      cout << 0 << endl;
    else if ((a % 2 == 1) && (b % 2 == 1))
      cout << -1 << endl;
    else if (a >= b) {
      while ((a % 8 == 0) && (a / 8 >= b)) {
        a = a / 8;
        count++;
      }
      while ((a % 4 == 0) && (a / 4 >= b)) {
        a = a / 4;
        count++;
      }
      while ((a % 2 == 0) && (a / 2 >= b)) {
        a = a / 2;
        count++;
      }
      if (a != b)
        cout << -1 << endl;
      else
        cout << count << endl;
    } else if (a <= b) {
      while (a * 8 <= b) {
        a = a * 8;
        count++;
      }
      while (a * 4 <= b) {
        a = a * 4;
        count++;
      }
      while (a * 2 <= b) {
        a = a * 2;
        count++;
      }
      if (a != b)
        cout << -1 << endl;
      else
        cout << count << endl;
    } else
      continue;
    t--;
  }
  return 0;
}
