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.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.*;
 
public class CeilDivisions {
	private static final FastReader fs = new FastReader();
	private static final PrintWriter out = new PrintWriter(System.out);
 
	private static void solve() {
		ArrayList<Integer> a=new ArrayList<>(), b=new ArrayList<>();
		int n=fs.nextInt(), on=n;
		for (int i=n-1; i>2; i--) {
			while (i*(long)i<=n) {
				n=(n+i-1)/i;
				a.add(on);
				b.add(i);
			}
			a.add(i);
			b.add(on);
		}
		while (n>1) {
			n=(n+1)/2;
			a.add(on);
			b.add(2);
		}
		out.println(a.size());
		for (int i=0; i<a.size(); i++) {
			out.println(a.get(i)+" "+b.get(i));
		}
	}
 
	public static void main(String[] args) {
		Thread t = new Thread(null, null, "", 1 << 28) {
			public void run() {
				int test_case = 1;
				test_case = fs.nextInt();
				for (int cs = 1; cs <= test_case; cs++) {
					solve();
				}
				out.close();
			}
		};
		t.start();
		try {
			t.join();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
 
	private static 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;
		}
 
		int[] readintarray(int n) {
			int res[] = new int[n];
			for (int i = 0; i < n; i++)
				res[i] = nextInt();
			return res;
		}
 
		long[] readlongarray(int n) {
			long res[] = new long[n];
			for (int i = 0; i < n; i++)
				res[i] = nextLong();
			return res;
		}
	}
 
	public static class pair<T1 extends Comparable<T1>, T2 extends Comparable<T2>> implements Comparable<pair<T1, T2>> {
		T1 ff;
		T2 ss;
 
		public pair(T1 ff, T2 ss) {
			this.ff = ff;
			this.ss = ss;
		}
 
		public int compareTo(pair<T1, T2> o) {
			if (ff == o.ff)
				return ss.compareTo(o.ss);
			return ff.compareTo(o.ff);
		}
	}
 
	private static class cf {
		public static long power(long base, long exponent) {
			long res = 1;
			while (exponent > 0) {
				if (exponent % 2 == 1)
					res *= base;
				exponent >>= 1;
				base *= base;
			}
			return res;
		}
 
		public static long mul(long a, long b, long mod) {
			return (a % mod * b % mod) % mod;
		}
 
		public static long add(long a, long b, long mod) {
			return (a % mod + b % mod) % mod;
		}
 
		public static long sub(long a, long b, long mod) {
			return ((a % mod - b % mod) % mod + mod) % mod;
		}
 
		public static long power(long base, long exponent, long mod) {
			long res = 1;
			base %= mod;
			while (exponent > 0) {
				if (exponent % 2 == 1)
					res = mul(res, base, mod);
				exponent >>= 1;
				base = mul(base, base, mod);
			}
			return res;
		}
 
		public static void sortIntArray(int[] a) {
			ArrayList<Integer> tmp = new ArrayList<>();
			for (int x : a)
				tmp.add(x);
			Collections.sort(tmp);
			for (int i = 0; i < tmp.size(); i++)
				a[i] = tmp.get(i);
		}
 
		public static void sortLongArray(long[] a) {
			ArrayList<Long> tmp = new ArrayList<>();
			for (long x : a)
				tmp.add(x);
			Collections.sort(tmp);
			for (int i = 0; i < tmp.size(); i++)
				a[i] = tmp.get(i);
		}
 
		public static <T extends Comparable<T>> void sort(T[] a) {
			ArrayList<T> tmp = new ArrayList<>();
			for (T x : a)
				tmp.add(x);
			Collections.sort(tmp);
			for (int i = 0; i < tmp.size(); i++)
				a[i] = tmp.get(i);
		}
 
		public static int __gcd(int a, int b) {
			return b == 0 ? a : __gcd(b, a % b);
		}
 
		public static long __gcd(long a, long b) {
			return b == 0 ? a : __gcd(b, a % b);
		}
 
		public static int max(int[] a) {
			int mx = a[0];
			for (int ele : a) {
				mx = Math.max(mx, ele);
			}
			return mx;
		}
 
		public static long max(long[] a) {
			long mx = a[0];
			for (long ele : a) {
				mx = Math.max(mx, ele);
			}
			return mx;
		}
 
		public static int min(int[] a) {
			int mn = a[0];
			for (int ele : a) {
				mn = Math.min(mn, ele);
			}
			return mn;
		}
 
		public static long min(long[] a) {
			long mn = a[0];
			for (long ele : a) {
				mn = Math.min(mn, ele);
			}
			return mn;
		}
	}
}