#include <bits/stdc++.h>
using namespace std;
long long int mod1 = 1000000007;
long long int mod2 = 67280421310721;
long long int mod3 = 998244353;
long long int INF = 1e18;
long long int binpow1(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
long long int binpow2(long long int a, long long int b, long long int m) {
  a %= m;
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
map<long long int, long long int> fact(long long int n) {
  map<long long int, long long int> factorization;
  long long int c = 0;
  while (n % 2 == 0) {
    c++;
    n /= 2;
  }
  if (c > 0) {
    factorization.insert({2, c});
  }
  c = 0;
  for (long long int d = 3; d * d <= n; d += 2) {
    while (n % d == 0) {
      c++;
      n /= d;
    }
    if (c > 0) {
      factorization.insert({d, c});
    }
    c = 0;
  }
  if (n > 1) {
    factorization.insert({n, 1});
  }
  return factorization;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int ans = n;
    vector<long long int> v1, v2;
    for (int i = (n - 1); i >= (1); i--) {
      v1.push_back(ans);
      v2.push_back(i);
      ans = (ans + i + 1) / 2;
    }
    cout << ans << '\n';
    for (int i = (0); i < (v1.size()); i++) {
      cout << v1[i] << " " << v2[i] << '\n';
    }
  }
  return 0;
}

### Prompt

In Cpp, your task is to solve the following problem:

Numbers 1, 2, 3, ... n (each integer from 1 to n once) are written on a board. In one operation you can erase any two numbers a and b from the board and write one integer (a + b)/(2) rounded up instead.

You should perform the given operation n - 1 times and make the resulting number that will be left on the board as small as possible. 

For example, if n = 4, the following course of action is optimal:

  1. choose a = 4 and b = 2, so the new number is 3, and the whiteboard contains [1, 3, 3]; 
  2. choose a = 3 and b = 3, so the new number is 3, and the whiteboard contains [1, 3]; 
  3. choose a = 1 and b = 3, so the new number is 2, and the whiteboard contains [2]. 



It's easy to see that after n - 1 operations, there will be left only one number. Your goal is to minimize it.

Input

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

The only line of each test case contains one integer n (2 ≤ n ≤ 2 ⋅ 10^5) — the number of integers written on the board initially.

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

Output

For each test case, in the first line, print the minimum possible number left on the board after n - 1 operations. Each of the next n - 1 lines should contain two integers — numbers a and b chosen and erased in each operation.

Example

Input


1
4


Output


2
2 4
3 3
3 1

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long int mod1 = 1000000007;
long long int mod2 = 67280421310721;
long long int mod3 = 998244353;
long long int INF = 1e18;
long long int binpow1(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
long long int binpow2(long long int a, long long int b, long long int m) {
  a %= m;
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
map<long long int, long long int> fact(long long int n) {
  map<long long int, long long int> factorization;
  long long int c = 0;
  while (n % 2 == 0) {
    c++;
    n /= 2;
  }
  if (c > 0) {
    factorization.insert({2, c});
  }
  c = 0;
  for (long long int d = 3; d * d <= n; d += 2) {
    while (n % d == 0) {
      c++;
      n /= d;
    }
    if (c > 0) {
      factorization.insert({d, c});
    }
    c = 0;
  }
  if (n > 1) {
    factorization.insert({n, 1});
  }
  return factorization;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int ans = n;
    vector<long long int> v1, v2;
    for (int i = (n - 1); i >= (1); i--) {
      v1.push_back(ans);
      v2.push_back(i);
      ans = (ans + i + 1) / 2;
    }
    cout << ans << '\n';
    for (int i = (0); i < (v1.size()); i++) {
      cout << v1[i] << " " << v2[i] << '\n';
    }
  }
  return 0;
}

```