#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k, x, y, i, j;
    long long a, b, c;
    int sum = 0;
    scanf("%lld%lld", &a, &b);
    if (a == b)
      printf("0\n");
    else {
      if (a > b) {
        c = a;
        a = b;
        b = c;
      }
      i = 0;
      while (1) {
        a = a << 1;
        i++;
        if (a == b) {
          sum++;
          printf("%d\n", sum);
          break;
        } else if (a > b) {
          printf("-1\n");
          break;
        } else if (i >= 3) {
          sum++;
          i = 0;
        }
      }
    }
  }
  return 0;
}
