Problem: This is the easy version of the problem. The only difference is that here k=2. You can make hacks only if both the versions of the problem are solved.

This is an interactive problem.

Every decimal number has a base k equivalent. The individual digits of a base k number are called k-its. Let's define the k-itwise XOR of two k-its a and b as (a + b)mod k.

The k-itwise XOR of two base k numbers is equal to the new number formed by taking the k-itwise XOR of their corresponding k-its. The k-itwise XOR of two decimal numbers a and b is denoted by a⊕_{k} b and is equal to the decimal representation of the k-itwise XOR of the base k representations of a and b. All further numbers used in the statement below are in decimal unless specified. When k = 2 (it is always true in this version), the k-itwise XOR is the same as the [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR).

You have hacked the criminal database of Rockport Police Department (RPD), also known as the Rap Sheet. But in order to access it, you require a password. You don't know it, but you are quite sure that it lies between 0 and n-1 inclusive. So, you have decided to guess it. Luckily, you can try at most n times without being blocked by the system. But the system is adaptive. Each time you make an incorrect guess, it changes the password. Specifically, if the password before the guess was x, and you guess a different number y, then the system changes the password to a number z such that x⊕_{k} z=y. Guess the password and break into the system.

Input

The first line of input contains a single integer t (1≤ t≤ 10 000) denoting the number of test cases. t test cases follow.

The first line of each test case contains two integers n (1≤ n≤ 2⋅ 10^5) and k (k=2).

It is guaranteed that the sum of n over all test cases does not exceed 2⋅ 10^5.

Interaction

For each test case, first read two integers n and k. Then you may ask up to n queries.

For each query, print a single integer y (0≤ y≤ 2⋅ 10^7). Let the current password be x. After that, read an integer r.

If x=y, you will read r=1 and the test case is solved. You must then continue solving the remaining test cases.

Else, you will read r=0. At this moment the password is changed to a number z such that x⊕_{k} z=y.

After printing a query, do not forget to output the end of line and flush the output. Otherwise, you will get the Idleness limit exceeded verdict.

To do this, use:

  * fflush(stdout) or cout.flush() in C++; 
  * System.out.flush() in Java; 
  * flush(output) in Pascal; 
  * stdout.flush() in Python; 
  * see documentation for other languages. 



If you ask an invalid query or exceed n queries, you will read r=-1 and you will receive the Wrong Answer verdict. Make sure to exit immediately to avoid unexpected verdicts.

Note that the interactor is adaptive. That is, the original password is not fixed in the beginning and may depend on your queries. But it is guaranteed that at any moment there is at least one initial password such that all the answers to the queries are consistent.

Hacks:

To use hacks, use the following format of tests:

The first line should contain a single integer t (1≤ t≤ 10 000) — the number of test cases.

The first and only line of each test case should contain two integers n (1≤ n≤ 2⋅ 10^5) and k (k=2) denoting the number of queries and the base respectively. The optimal original password is automatically decided by the adaptive interactor.

You must ensure that the sum of n over all test cases does not exceed 2⋅ 10^5.

Example

Input


1
5 2

0

0

1


Output


3

4

5

Note

In the example test case, the hidden password is 2.

The first query is 3. It is not equal to the current password. So, 0 is returned, and the password is changed to 1 since 2⊕_2 1=3.

The second query is 4. It is not equal to the current password. So, 0 is returned, and the password is changed to 5 since 1⊕_2 5=4.

The third query is 5. It is equal to the current password. So, 1 is returned, and the job is done.

Note that this initial password is taken just for the sake of explanation. When you submit, the interactor might behave differently because it is adaptive.

Solution (in JAVA):

Solution:
import java.util.*;
import java.io.*;
import static java.lang.System.out;
import java.util.Stack;
import java.util.Queue;

public class D11543
{

    static int mod=(int)(1e9+7);
    static long MOD=(long)(1e9+7);
    
        
    public static void main(String args[]) throws IOException
    {  
		FastReader in=new FastReader(System.in);
		PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        int tc=1;
     
        tc=in.nextInt();
        tcloop: while(tc-->0)
        {
			int n=in.nextInt();
			int k=in.nextInt();
			
			for(int i=1;i<=n;i++)
			{
				int x=-1;
				
				if(i==1)
					x=0;
				else
					x=((i-1)^(i-2));
					
				pr.println(x);
				pr.flush();
				int res=in.nextInt();
				if(res==1)
				{
					continue tcloop;
				}
				
			}
				
				
				
		}
			
            


        
        pr.flush();
        
    }
	
	

    

    static void sort(long[] a) {
		ArrayList<Long> l = new ArrayList<>();
		for (long i : a)
			l.add(i);
		Collections.sort(l);
		for (int i = 0; i < a.length; i++)
			a[i] = l.get(i);
	}
    
    
	static void sort(int[] a) {
		ArrayList<Integer> l = new ArrayList<>();
		for (int i : a)
			l.add(i);
		Collections.sort(l);
		for (int i = 0; i < a.length; i++)
			a[i] = l.get(i);
    }

    private static class FastReader implements Closeable {
        private static final byte B_SP = ' ';
        private static final byte B_CR = '\r';
        private static final byte B_LF = '\n';
        private static final byte B_0 = '0';
        private static final byte B_9 = '9';
        private static final byte B_DASH = '-';
 
        private final InputStream in;
        private byte prev;
 
        public FastReader(InputStream in) {
            this.in = in;
        }
 
        public byte read() throws IOException {
            return (prev = (byte) in.read());
        }
 
        public byte readNonWs() throws IOException {
            byte b;
            do {
                b = read();
            } while (b <= B_SP);
            return b;
        }
 
        public int nextInt() throws IOException {
            byte b = readNonWs();
            final boolean neg = (b == B_DASH);
            if (neg) {
                b = read();
            }
            int i = (b - B_0);
            b = read();
            while (b >= B_0 && b <= B_9) {
                i = i * 10 + (b - B_0);
                b = read();
            }
            return neg ? -i : i;
        }
 
        public long nextLong() throws IOException {
            byte b = readNonWs();
            final boolean neg = (b == B_DASH);
            if (neg) {
                b = read();
            }
            long i = (b - B_0);
            b = read();
            while (b >= B_0 && b <= B_9) {
                i = i * 10 + (b - B_0);
                b = read();
            }
            return neg ? -i : i;
        }
 
        public int readToken(byte[] tbuf) throws IOException {
            byte b = readNonWs();
            int i = 0;
            do {
                tbuf[i++] = b;
                b = read();
            } while (b >= B_SP);
            return i;
        }
 
        public int readLine(byte[] lbuf) throws IOException {
            byte b;
            if (prev == B_CR) {
                b = read();
                if (b == B_LF) {
                    b = read();
                }
            } else {
                b = read();
            }
            int i = 0;
            while (b >= B_SP) {
                lbuf[i++] = b;
                b = read();
            }
            return i;
        }
 
        @Override
        public void close() throws IOException {
            in.close();
        }
	}
}