import java.io.*;
import java.util.*;

public class sequence_mb {
    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(new File("sequence.in"));
        PrintWriter out = new PrintWriter("sequence.out");

        int T = in.nextInt();
        assert 1 <= T && T <= 1000;

        for (int i = 0; i < T; i++) {
            long k = in.nextLong();
            long p = in.nextLong();

            assert 1 <= k;
            assert 1 <= p;

            if (p > 62 || k < (1L << p)) {
                int ans = 1;
                while ((k & 1) == 0) {
                    ans++;
                    k >>= 1;
                }
                out.println(ans);
            } else {
                out.println("No solution");
            }
        }
        in.close();
        out.close();
    }
}