#include <bits/stdc++.h>
using namespace std;
const int infi = 1e9;
const long long int infl = 1e18;
const int MOD = 1e9 + 7;
long long int log_2(long long int n) {
  return (n > 1ll) ? 1ll + log_2(n / 2) : 0ll;
}
inline void add(long long int &a, long long int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
inline void sub(long long int &a, long long int b) {
  a -= b;
  if (a < 0) a += MOD;
}
inline string IntToString(long long int a) {
  char x[100];
  sprintf(x, "%lld", a);
  string s = x;
  return s;
}
inline long long int StringToInt(string a) {
  char x[100];
  long long int res;
  strcpy(x, a.c_str());
  sscanf(x, "%lld", &res);
  return res;
}
inline string GetString(void) {
  char x[1000005];
  scanf("%s", x);
  string s = x;
  return s;
}
inline string uppercase(string s) {
  int n = (int)s.size();
  for (int(i) = (0); (i) < (n); ++(i))
    if (s[i] >= 'a' && s[i] <= 'z') s[i] = s[i] - 'a' + 'A';
  return s;
}
inline string lowercase(string s) {
  int n = (int)s.size();
  for (int(i) = (0); (i) < (n); ++(i))
    if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
  return s;
}
inline void OPEN(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
void showarr(long long int arr[], long long int n) {
  int i;
  for (i = 0; i < n; i++) {
    cout << arr[i] << " ";
  }
  cout << endl;
}
void showvec(vector<long long int> v) {
  int i;
  for (i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << endl;
}
int isPalindrome(string str) {
  int l = 0;
  int h = str.length() - 1;
  while (h > l) {
    if (str[l++] != str[h--]) {
      return 0;
    }
  }
  return 1;
}
void showvecpair(vector<pair<long long int, long long int> > v) {
  for (int i = 0; i < (int)v.size(); i++) {
    cout << v[i].first << " " << v[i].second << endl;
  }
}
bool sortbysec(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
void bin(unsigned n) {
  unsigned i;
  for (i = 1 << 31; i > 0; i = i / 2) (n & i) ? printf("1") : printf("0");
}
long long int cntset(long long int n) {
  bitset<64> b1(n);
  return b1.count();
}
void solve() {
  long long int l, a, b, n, i, j, max = INT_MIN, min = INT_MAX, ctr = 0,
                                  cnt = 0, x, k;
  cin >> n;
  cout << "2" << endl;
  a = n;
  b = n - 2;
  if (n == 2) {
    cout << "1 2" << endl;
  } else {
    for (i = 1; i <= n - 1; i++) {
      if (i == 2) {
        cout << x << " " << x << endl;
        continue;
      }
      cout << a << " " << b << endl;
      x = (a + b) / 2;
      a = x;
      b = x - 2;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int i, T;
  cin >> T;
  for (i = 1; i <= T; i++) {
    solve();
  }
  return 0;
}

### Prompt

Please provide a Cpp coded solution to the problem described below:

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;
const int infi = 1e9;
const long long int infl = 1e18;
const int MOD = 1e9 + 7;
long long int log_2(long long int n) {
  return (n > 1ll) ? 1ll + log_2(n / 2) : 0ll;
}
inline void add(long long int &a, long long int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
inline void sub(long long int &a, long long int b) {
  a -= b;
  if (a < 0) a += MOD;
}
inline string IntToString(long long int a) {
  char x[100];
  sprintf(x, "%lld", a);
  string s = x;
  return s;
}
inline long long int StringToInt(string a) {
  char x[100];
  long long int res;
  strcpy(x, a.c_str());
  sscanf(x, "%lld", &res);
  return res;
}
inline string GetString(void) {
  char x[1000005];
  scanf("%s", x);
  string s = x;
  return s;
}
inline string uppercase(string s) {
  int n = (int)s.size();
  for (int(i) = (0); (i) < (n); ++(i))
    if (s[i] >= 'a' && s[i] <= 'z') s[i] = s[i] - 'a' + 'A';
  return s;
}
inline string lowercase(string s) {
  int n = (int)s.size();
  for (int(i) = (0); (i) < (n); ++(i))
    if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
  return s;
}
inline void OPEN(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
void showarr(long long int arr[], long long int n) {
  int i;
  for (i = 0; i < n; i++) {
    cout << arr[i] << " ";
  }
  cout << endl;
}
void showvec(vector<long long int> v) {
  int i;
  for (i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << endl;
}
int isPalindrome(string str) {
  int l = 0;
  int h = str.length() - 1;
  while (h > l) {
    if (str[l++] != str[h--]) {
      return 0;
    }
  }
  return 1;
}
void showvecpair(vector<pair<long long int, long long int> > v) {
  for (int i = 0; i < (int)v.size(); i++) {
    cout << v[i].first << " " << v[i].second << endl;
  }
}
bool sortbysec(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
void bin(unsigned n) {
  unsigned i;
  for (i = 1 << 31; i > 0; i = i / 2) (n & i) ? printf("1") : printf("0");
}
long long int cntset(long long int n) {
  bitset<64> b1(n);
  return b1.count();
}
void solve() {
  long long int l, a, b, n, i, j, max = INT_MIN, min = INT_MAX, ctr = 0,
                                  cnt = 0, x, k;
  cin >> n;
  cout << "2" << endl;
  a = n;
  b = n - 2;
  if (n == 2) {
    cout << "1 2" << endl;
  } else {
    for (i = 1; i <= n - 1; i++) {
      if (i == 2) {
        cout << x << " " << x << endl;
        continue;
      }
      cout << a << " " << b << endl;
      x = (a + b) / 2;
      a = x;
      b = x - 2;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int i, T;
  cin >> T;
  for (i = 1; i <= T; i++) {
    solve();
  }
  return 0;
}

```