import java.util.*; public class Main { public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for(int i = 0; i < T; ++i){ int n = sc.nextInt(); List<Integer> org = new ArrayList<>(); for(int j = 1; j <= n; ++j) org.add(j); //生成原始队列 Deque<Integer> ans = g(org); //对原始队列作逆操作 print(ans); } } static void print(Deque<Integer> v){ //打印输出 while(!v.isEmpty()){ if(v.size()==1) System.out.println(v.getFirst()); else System.out.print(v.getFirst()+" "); v.removeFirst(); } } static Deque<Integer> g(List<Integer> v){ //题给的队列操作的逆操作 Deque<Integer> ans = new LinkedList<>(); while(!v.isEmpty()){ int x = v.get(v.size()-1); v.remove(v.size()-1); ans.addFirst(x); int y=ans.getLast(); ans.removeLast(); ans.addFirst(y); } return ans; } }