#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    unsigned long long a, b;
    cin >> a >> b;
    if (max(a, b) % min(a, b)) {
      cout << -1 << endl;
      continue;
    }
    int dem = 0;
    long long p = max(a, b) / min(a, b);
    while (p != 1) {
      if (p % 8 == 0) {
        dem++;
        p /= 8;
      } else if (p % 4 == 0) {
        dem++;
        p /= 4;
      } else if (p % 2 == 0) {
        dem++;
        p /= 2;
      } else {
        dem = -1;
        break;
      }
    }
    cout << dem << endl;
  }
}
