#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
string binary(int n) {
  string bin;
  while (n) {
    bin += (n % 2 ? '1' : '0');
    n /= 2;
  }
  reverse(bin.begin(), bin.end());
  return bin;
}
bool isPalindrome(string& s) {
  for (int i = 0, j = s.size() - 1; i < j; i++, j--)
    if (s[i] != s[j]) return 0;
  return 1;
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
inline vector<int> sieve(int n) {
  vector<bool> isPrime(n + 1, true);
  for (int i = 2; i <= sqrt(n); i++) {
    if (isPrime[i])
      for (int j = 2 * i; j <= n; j += i) {
        isPrime[j] = false;
      }
  }
  vector<int> primes;
  for (int i = 2; i <= n; i++)
    if (isPrime[i]) primes.push_back(i);
  return primes;
}
inline vector<int> primeFactors(int n) {
  vector<int> factors;
  vector<int> primes = sieve(100000);
  int i = 0;
  while (n != 1 && i < primes.size()) {
    if (n % primes[i] == 0) {
      factors.push_back(primes[i]);
      n /= primes[i];
    } else {
      i++;
    }
  }
  return factors;
}
void shift_right(vector<int>& A, int x) {
  int n = A.size();
  x %= n;
  vector<int> B(n);
  for (int i = 0; i < n; i++) B[(i + x) % n] = A[i];
  A = B;
}
inline vector<bool> sieveQuery(int n) {
  vector<bool> isPrime(n + 1, true);
  for (int i = 2; i <= sqrt(n); i++) {
    if (isPrime[i])
      for (int j = 2 * i; j <= n; j += i) {
        isPrime[j] = false;
      }
  }
  return isPrime;
}
long long lcm(long long a, long long b) {
  return (min(a, b) / gcd(a, b)) * max(a, b);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    if (n == 2) {
      cout << "2\n1 2\n";
    } else {
      cout << "2\n" << n << ' ' << n - 2 << '\n';
      stack<int> s;
      for (int i = 1; i <= n - 1; i++) {
        if (i == n - 2) continue;
        s.push(i);
      }
      s.push(n - 1);
      while (s.size() > 1) {
        int a, b;
        a = s.top();
        s.pop();
        b = s.top();
        s.pop();
        s.push((a + b + 1) / 2);
        cout << a << ' ' << b << '\n';
      }
    }
  }
}

### Prompt

Your challenge is to write a cpp solution to 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;
const double PI = acos(-1);
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
string binary(int n) {
  string bin;
  while (n) {
    bin += (n % 2 ? '1' : '0');
    n /= 2;
  }
  reverse(bin.begin(), bin.end());
  return bin;
}
bool isPalindrome(string& s) {
  for (int i = 0, j = s.size() - 1; i < j; i++, j--)
    if (s[i] != s[j]) return 0;
  return 1;
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
inline vector<int> sieve(int n) {
  vector<bool> isPrime(n + 1, true);
  for (int i = 2; i <= sqrt(n); i++) {
    if (isPrime[i])
      for (int j = 2 * i; j <= n; j += i) {
        isPrime[j] = false;
      }
  }
  vector<int> primes;
  for (int i = 2; i <= n; i++)
    if (isPrime[i]) primes.push_back(i);
  return primes;
}
inline vector<int> primeFactors(int n) {
  vector<int> factors;
  vector<int> primes = sieve(100000);
  int i = 0;
  while (n != 1 && i < primes.size()) {
    if (n % primes[i] == 0) {
      factors.push_back(primes[i]);
      n /= primes[i];
    } else {
      i++;
    }
  }
  return factors;
}
void shift_right(vector<int>& A, int x) {
  int n = A.size();
  x %= n;
  vector<int> B(n);
  for (int i = 0; i < n; i++) B[(i + x) % n] = A[i];
  A = B;
}
inline vector<bool> sieveQuery(int n) {
  vector<bool> isPrime(n + 1, true);
  for (int i = 2; i <= sqrt(n); i++) {
    if (isPrime[i])
      for (int j = 2 * i; j <= n; j += i) {
        isPrime[j] = false;
      }
  }
  return isPrime;
}
long long lcm(long long a, long long b) {
  return (min(a, b) / gcd(a, b)) * max(a, b);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    if (n == 2) {
      cout << "2\n1 2\n";
    } else {
      cout << "2\n" << n << ' ' << n - 2 << '\n';
      stack<int> s;
      for (int i = 1; i <= n - 1; i++) {
        if (i == n - 2) continue;
        s.push(i);
      }
      s.push(n - 1);
      while (s.size() > 1) {
        int a, b;
        a = s.top();
        s.pop();
        b = s.top();
        s.pop();
        s.push((a + b + 1) / 2);
        cout << a << ' ' << b << '\n';
      }
    }
  }
}

```