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 CPP):

Solution:
/* UNDERESTIMATE ME
    THAT'LL BE FUN */


// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("avx,avx2,sse,sse2")


#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include<climits>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>
#include <chrono>
using namespace std;
#define ld long double
#define int long long
#define pii pair<int,int>
#define pb push_back
#define endl '\n'
const int inf = LLONG_MAX;

#define pi acos(-1)

#define init(x,a) memset(x,a,sizeof(x))
#define all(c) c.begin(),c.end()
//int const mod = 998244353;
int const mod = 1e9 + 7;
int const hashmod = 1610612741;
#define bitcount(x)       __builtin_popcountll(x)
#define l first
#define r second

int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define haha ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// * Using PBDS *
/*typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
               os; */

struct cmp
{
	bool operator() (pair<int, int> a, pair<int, int> b) {

		return a.r > b.r;


	}
};

int modexp(int x, int n) {
	if (n == 0) {
		return 1;
	}
	else if (n & 1) {
		return (modexp((x * x) % mod, n / 2) % mod * x % mod) % mod;
	}
	else {
		return (modexp((x * x) % mod, n / 2) % mod);
	}
}

int modinv(int n)
{
	return modexp(n, mod - 2) % mod;
}

int fact[400005];

void fact_pre() {
	fact[0] = 1;
	for (int i = 1; i <= 400000; i++) {
		fact[i] = (fact[i - 1] * i) % mod;
	}
}

int ncr(int n, int r) {
	if (r > n) return 0;
	int a = fact[n];
	a *= modinv((fact[n - r] * fact[r]) % mod);
	return a % mod;
}


int gcd(int a, int b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
}
bool comp1(pii a, pii b) {
	return a.l > b.l;
}

bool comp2(pair<pii, int> a, pair<pii, int> b) {

	if (a.l.l == b.l.l)
		return a.r < b.r;

	return (a.l.l < b.l.l );
}
bool comp3(string a, string b) {

	return a + b < b + a;
}


bool go(int x, int y, int l, int r) {
	if (y < l)
		return false;
	if (x > r)
		return false;



	return true;
}



void solve() {
	int n;
	cin >> n;
	vector<pii> v;
	int c = 0;
	for (int i = 3; i < n; i++) {
		if (i == 5 || i == 22 || i == 448)
			continue;
		v.pb({i, n});
		c++;
	}
	if (n > 448) {
		v.pb({n, 448});
		v.pb({n, 448});
		c += 2;
		n = 448;

	}
	if (n > 22) {
		v.pb({n, 22});
		v.pb({n, 22});
		c += 2;
		n = 22;

	}

	if (n > 5) {
		v.pb({n, 5});
		v.pb({n, 5});
		c += 2;
		n = 5;

	}
	if (n > 2) {
		v.pb({n, 2});
		v.pb({n, 2});
		v.pb({n, 2});
		c += 3;


	}


	cout << c << endl;
	for (auto x : v)
		cout << x.l << " " << x.r << endl;








}




signed main() {
	haha

#ifndef ONLINE_JUDGE

	freopen("inp.txt", "r", stdin);

	freopen("out2.txt", "w", stdout);
#endif
	int t;
	cin >> t;
	//t = 1;

	while (t--) {


		solve();
	}


}