import java.io.*;
import java.math.*;
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner cin = new Scanner(System.in);
int a[] = new int[100];
Queue<Integer> q = new LinkedList<Integer>();
int t,n;
t = cin.nextInt();
while(t-- != 0){
n = cin.nextInt();
q.offer(n);
for(int i = n - 1; i >= 1; i--){
q.offer(i);
for(int j = 1; j <= i; j++){
int temp = q.peek();
q.poll();
q.offer(temp);
}
}
for(int i = n - 1; i >= 0; i--){
a[i] = q.peek();
q.poll();
}
for(int i = 0; i < n-1; i++)
System.out.print(a[i]+" ");
System.out.println(a[n-1]);
}
}
}
import java.math.*;
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner cin = new Scanner(System.in);
int a[] = new int[100];
Queue<Integer> q = new LinkedList<Integer>();
int t,n;
t = cin.nextInt();
while(t-- != 0){
n = cin.nextInt();
q.offer(n);
for(int i = n - 1; i >= 1; i--){
q.offer(i);
for(int j = 1; j <= i; j++){
int temp = q.peek();
q.poll();
q.offer(temp);
}
}
for(int i = n - 1; i >= 0; i--){
a[i] = q.peek();
q.poll();
}
for(int i = 0; i < n-1; i++)
System.out.print(a[i]+" ");
System.out.println(a[n-1]);
}
}
}