#include<iostream>
using namespace std;
int main()
{
int n,m;
cin>>n;
while(n--)
{
cin>>m;
switch(m)
{
case 1: cout<<"1"<<endl;break;
case 2: cout<<"2 1"<<endl;break;
case 3: cout<<"3 1 2"<<endl;break;
case 4: cout<<"2 1 4 3"<<endl;break;
case 5: cout<<"3 1 4 5 2"<<endl;break;
case 6: cout<<"4 1 6 3 2 5"<<endl;break;
case 7: cout<<"5 1 3 4 2 6 7"<<endl;break;
case 8: cout<<"3 1 7 5 2 6 8 4"<<endl;break;
case 9: cout<<"7 1 8 6 2 9 4 5 3"<<endl;break;
case 10: cout<<"9 1 8 5 2 4 7 6 3 10"<<endl;break;
case 11: cout<<"5 1 6 4 2 10 11 7 3 8 9"<<endl;break;
case 12: cout<<"7 1 4 9 2 11 10 8 3 6 5 12"<<endl;break;
case 13: cout<<"4 1 13 11 2 10 6 7 3 5 12 9 8"<<endl;break;
}
}
return 0;
}