#include <bits/stdc++.h> using namespace std; int main(){ int n, m; cin >> m; while (m --){ cin >> n; queue<int> q; for (int i=1; i<=n; i++){ q.push(i); } while (!q.empty()) { for (int i=1; i<3; i++){ q.push(q.front()); q.pop(); } cout << q.front() << " "; q.pop(); } puts(""); } return 0; }