import std.stdio;
import std.stdio;
import std.algorithm;
import std.range;
import std.functional;
import std.conv;
import std.string;
import std.math;
import core.bitop;

void main() {
	int tt = readln().chomp.to!int;
	foreach (t; 0 .. tt) {
		auto arr = readln().chomp.split(" ").map!(to!ulong);
		ulong a = arr[0];
		ulong b = arr[1];
		if (b < a) {
			ulong tm = a;
			a = b;
			b = tm;
		}
		if (b > a) {
			if (b % a != 0) {
				writeln(-1);
				continue;
			}
			ulong diff = b / a;
			ulong high = bsr(diff);
			if ((1UL << high) == diff) {
				writeln(
					high / 3 + (high % 3) / 2 + (high % 3) % 2
				);
			}
			else {
				writeln(-1);
			}
		}
		else {
			writeln(0);
		}
	}
}
