Problem: You have an array a_1, a_2, ..., a_n where a_i = i.

In one step, you can choose two indices x and y (x ≠ y) and set a_x = \left⌈ (a_x)/(a_y) \right⌉ (ceiling function).

Your goal is to make array a consist of n - 1 ones and 1 two in no more than n + 5 steps. Note that you don't have to minimize the number of steps.

Input

The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases.

The first and only line of each test case contains the single integer n (3 ≤ n ≤ 2 ⋅ 10^5) — the length of array a.

It's guaranteed that the sum of n over test cases doesn't exceed 2 ⋅ 10^5.

Output

For each test case, print the sequence of operations that will make a as n - 1 ones and 1 two in the following format: firstly, print one integer m (m ≤ n + 5) — the number of operations; next print m pairs of integers x and y (1 ≤ x, y ≤ n; x ≠ y) (x may be greater or less than y) — the indices of the corresponding operation.

It can be proven that for the given constraints it's always possible to find a correct sequence of operations.

Example

Input


2
3
4


Output


2
3 2
3 2
3
3 4
4 2
4 2

Note

In the first test case, you have array a = [1, 2, 3]. For example, you can do the following: 

  1. choose 3, 2: a_3 = \left⌈ (a_3)/(a_2) \right⌉ = 2 and array a = [1, 2, 2]; 
  2. choose 3, 2: a_3 = \left⌈ 2/2 \right⌉ = 1 and array a = [1, 2, 1]. 

You've got array with 2 ones and 1 two in 2 steps.

In the second test case, a = [1, 2, 3, 4]. For example, you can do the following: 

  1. choose 3, 4: a_3 = \left⌈ 3/4 \right⌉ = 1 and array a = [1, 2, 1, 4]; 
  2. choose 4, 2: a_4 = \left⌈ 4/2 \right⌉ = 2 and array a = [1, 2, 1, 2]; 
  3. choose 4, 2: a_4 = \left⌈ 2/2 \right⌉ = 1 and array a = [1, 2, 1, 1]. 

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;
import java.math.*;
import java.math.BigInteger;
import java.util.LinkedList; 
import java.util.Queue;


 public final class A
{    
    static StringBuilder ans=new StringBuilder();
    static FastReader in=new FastReader();
    static ArrayList<ArrayList<Integer>> g;
    static long mod=1000000007;
    static boolean set[];   
   
    public static void main(String args[])throws IOException
    { 	 
    int T=i();
    while(T-->0)
    {
    	int N=i();
    	if(N==3)
    	{
    		ans.append("2\n");
    		ans.append("3 2\n");
    		ans.append("3 2\n");
    		System.out.println(ans);
    		ans.delete(0,ans.length());
    	}
    	else if(N==4)
    	{
    		ans.append("3\n");
    		ans.append("3 4\n");
    		ans.append("4 2\n");
    		ans.append("4 2");
    		System.out.println(ans);
    		ans.delete(0,ans.length());
    	}
    	else if(N<=10)
    	{
    		int c=0;
    		for(int i=N-1; i>3; i--)
    		{
    			ans.append(i+" "+N+"\n");
    			c++;
    		}
    		c+=5;
    		ans.append(N+" "+3+"\n");
    		ans.append(N+" "+3+"\n");
    		ans.append(N+" "+3+"\n");
    		ans.append(3+" "+2+"\n");
    		ans.append(3+" "+2);   		
    	     System.out.println(c);
    		System.out.println(ans);
    		ans.delete(0,ans.length());
    	}
    	else
    	{
    		int num=1;
    		while(num*10<N)
    		{
    			num*=10;
    		}
    		int c=0;
    		//System.out.println(num);
    		for(int i=N-1; i>=10; i--)
    		{
    			if(i==num)
    			{
    				ans.append(N+" "+num+"\n");
    				ans.append(N+" "+num+"\n");
    				N=num;
    				num/=10;
    				c+=2;
    				
    			}
    			else
    			{
    				c++;
    				ans.append(i+" "+N+"\n");
    			}
    		}
    		for(int i=9; i>4; i--)
    		{
    			ans.append(i+" "+10+"\n");
    			c++;
    		}
    		c+=5;
    		ans.append(10+" "+4+"\n");
    		ans.append(10+" "+4+"\n");
    		ans.append(3+" "+4+"\n");
    		ans.append(4+" "+2+"\n");
    		ans.append(4+" "+2);   		
    	     System.out.println(c);
    		System.out.println(ans);
    		ans.delete(0,ans.length());
    	}
    	
    }
    System.out.println(ans);
      
           	
    }
    
  
    	static boolean isSorted(int A[])
    	{
    		for(int i=1; i<A.length; i++)
    		{
    			if(A[i]<A[i-1])return false;
    		}
    		return true;
    	}
    static void f(long N)
    	 {
    		 if(N==1)
    		 {
    			 //ans.append(1);
    			System.out.println(ans);
    		 }
    		 else  if(N%2==0)
    		 {
    			 ans.append(N/2+" ");
    			 f(N/2);
    			 
    		 }
    		 else 
    		 {
    			 N=N*3+1;
    			 ans.append(N+" ");
    			 f(N);
    		 }
    	 }
     static boolean isDivisible(StringBuilder X,int i,long num)
    	 {
    		 long r=0;
    		 for(; i<X.length(); i++)
    		 {
    			 r=r*10+(X.charAt(i)-'0');
    			 r=r%num;
    		 }
    		 return r==0;
    	 }    
     static void print(int A[])
          
     {
  	   for(int i:A)System.out.print(i+" ");
  	System.out.println();   
     }
     

     static void print(long A[])
     {
	 for(long i:A)System.out.print(i+ " ");
	 System.out.println();
          		 
      }
   
     
     static int lower_Bound(int A[],int low,int high, int x) 
        { 
            if (low > high) 
            if (x >= A[high]) 
                return A[high]; 
      
            int mid = (low + high) / 2; 
             
            if (A[mid] == x) 
                return A[mid]; 
      
            if (mid > 0 && A[mid - 1] <= x && x < A[mid]) 
                return A[mid - 1]; 

            if (x < A[mid]) 
                return lower_Bound( A, low, mid - 1, x); 
 
            return lower_Bound(A, mid + 1, high, x); 
        } 
             
    static String f(String A)
    {
    	String X="";
        for(int i=A.length()-1; i>=0; i--)
        {
            int c=A.charAt(i)-'0';
            X+=(c+1)%2;
        }
        return X;
    }

    static void sort(long[] a) //check for long
    {
        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 String swap(String X,int i,int j)
    {
        char ch[]=X.toCharArray();
        char a=ch[i];
        ch[i]=ch[j];
        ch[j]=a;
        return new String(ch);
    }

    static int sD(long n)  
    {  

        if (n % 2 == 0 )  
            return 2;  

        for (int i = 3; i * i <= n; i += 2) {  
            if (n % i == 0 )  
                return i;  
        }  

        return (int)n;  
    }  

    static void setGraph(int N)
    {
        set=new boolean[N+1];
        g=new ArrayList<ArrayList<Integer>>();
        for(int i=0; i<=N; i++)
            g.add(new ArrayList<Integer>());
    }

    static void DFS(int N,int d)
    {
        set[N]=true;
        d++;
        for(int i=0; i<g.get(N).size(); i++)
        {
            int c=g.get(N).get(i);
            if(set[c]==false)
            {
                DFS(c,d);
            }
        }
    }

    static  long pow(long a,long b)
    {
        long mod=1000000007;
        long pow=1;
        long x=a;
        while(b!=0)
        {
            if((b&1)!=0)pow=(pow*x)%mod;
            x=(x*x)%mod;
            b/=2;
        }
        return pow;
    }

    static long toggleBits(long x)//one's complement || Toggle bits
    {
        int n=(int)(Math.floor(Math.log(x)/Math.log(2)))+1;

        return ((1<<n)-1)^x;
    }

    static int countBits(long a)
    {
        return (int)(Math.log(a)/Math.log(2)+1);
    }

    static long fact(long N)
    { 
        long n=2; 
        if(N<=1)return 1;
        else
        {
            for(int i=3; i<=N; i++)n=(n*i)%mod;
        }
        return n;
    }

    static int kadane(int A[])
    {
        int lsum=A[0],gsum=A[0];
        for(int i=1; i<A.length; i++)
        {
            lsum=Math.max(lsum+A[i],A[i]);
            gsum=Math.max(gsum,lsum);
        }
        return gsum;
    }

    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);
    }

    static boolean isPrime(long N)
    {
        if (N<=1)  return false; 
        if (N<=3)  return true; 
        if (N%2 == 0 || N%3 == 0) return false; 
        for (int i=5; i*i<=N; i=i+6) 
            if (N%i == 0 || N%(i+2) == 0) 
                return false; 
        return true; 
    }

    static int i()
    {
        return in.nextInt();
    }

    static long l()
    {
        return in.nextLong();
    }

    static int[] input(int N){
        int A[]=new int[N];
        for(int i=0; i<N; i++)
        {
            A[i]=in.nextInt();
        }
        return A;
    }

    static long[] inputLong(int N)     {
        long A[]=new long[N];
        for(int i=0; i<A.length; i++)A[i]=in.nextLong();
        return A;
    }

    static long GCD(long a,long b) 
    {
        if(b==0)
        {
            return a;
        }
        else return GCD(b,a%b );
    }

}

class ABC
{
	HashMap<Integer,Integer> mp;
	ABC()
	{
		mp=new HashMap<Integer,Integer>();
	}
	}


class pair implements Comparable<pair>
{
	long a,b;
	pair(long a,long b)
	{
		this.a=a;
		this.b=b;
	}
	public int compareTo(pair x)
	{
		return this.a-x.a;
	}
}

//Code For FastReader
//Code For FastReader
//Code For FastReader
//Code For FastReader
class FastReader
{
    BufferedReader br;
    StringTokenizer st;
    public FastReader()
    {
        br=new BufferedReader(new InputStreamReader(System.in));
    }

    String next()
    {
        while(st==null || !st.hasMoreElements())
        {
            try
            {
                st=new StringTokenizer(br.readLine());
            }
            catch(IOException e)
            {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt()
    {
        return Integer.parseInt(next());
    }

    long nextLong()
    {
        return Long.parseLong(next());
    }

    double nextDouble()
    {
        return Double.parseDouble(next());
    }

    String nextLine()
    {
        String str="";
        try
        {
            str=br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }

}