#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       vector<int> a(n);       cout << 2 << endl;       int prev = (n + n - 1) / 2;       if ((n + n - 1) % 2 != 0) prev++;       cout << n <<     << n - 1 << endl;       for (int i = n - 2; i >= 1; i--) {         int ad = 0;         cout << i <<     << prev << endl;         if ((i + prev) % 2 != 0) ad = 1;         prev = (i + prev) / 2 + ad;       }     }   }   