import java.util.Scanner;
import java.util.ArrayList;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int len = sc.nextInt();
        for(int i = 0; i < len; i++){
            int nums = sc.nextInt();
            getResult(nums);
            System.out.println();
        }
    }
    
    public static void getResult(int nums){
        ArrayList<Integer> temp = new ArrayList<Integer>();
        for(int i = 1; i <= nums; i++){
            temp.add(i);
        }
        while(temp.size() >= 3){
            System.out.print(temp.get(0) + " ");
            temp.add(temp.get(1));
            temp.remove(0);
            temp.remove(0);
        }
        for(Integer i : temp){
            System.out.print(i + " ");
        }
    }
}