#include <iostream>
#include <queue>
using namespace std;
queue<int> q;

int main(){
    int m;
    cin >> m;
    while(m--){
        int n, cnt = 0;
        cin >> n;
        for(int i = 1; i <= n; i ++) q.push(i);
        while(q.size()){
            int t = q.front();
            q.pop();
            cnt ++;
            if(cnt != 3) q.push(t);
            else{
                cout << t << ' ';
                cnt = 0;
            } 
        }
        cout << endl;
    }

    return 0;
}