import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
int res = 0;
long a = sc.nextLong();
long b = sc.nextLong();
// 令a是大的那个;
if (a == b) {
System.out.println(0);
continue;
} else if (a < b) {
long temp = a;
a = b;
b = temp;
}
while (a % 8 == 0 && a / 8 >= b) {
a /= 8;
res++;
}
while (a % 4 == 0 && a / 4 >= b) {
a /= 4;
res++;
}
while (a % 2 == 0 && a / 2 >= b) {
a /= 2;
res++;
}
if (a == b) {
System.out.println(res);
} else {
System.out.println(-1);
}
}
}
}
#微众银行23秋招笔试,是我太菜了#