package com.thinker.saima;

import java.util.Scanner;

/**
 * 
 *
 * http://exercise.acmcoder.com/online/online_judge_ques?ques_id=1650&konwledgeId=136
 * */
public class JunDuiDuiLie{

	public boolean check(int[] arr){
		boolean flag = false; 
		int count = 0;
		for(int i=0;i<arr.length;i++){
			if(arr[i] == 0) count ++;
		}
		if(count <= 3) flag = true;
		return flag;
	}

	public void main(int num){
		int[] arr = new int[num];
		for(int i=0;i<num;i++){
			arr[i] = 0;
		}
		boolean flag = true;
		while(flag){
			int count = 0;
			for(int j=0;j<num;j++){
				if(arr[j] == 0){
					count ++;
					if(count == 2){
						arr[j] = 1;count = 0;
					}
				}
			}
			count = 0;
			if(check(arr)) break;
			for(int j=0;j<num;j++){
				if(arr[j] == 0){
					count ++;
					if(count == 3) {
						arr[j] = 1;count = 0;
					}
				}
			}
			if(check(arr)) break;

		}
		for(int i=0;i<num;i++){
			if(arr[i] == 0) {System.out.print(i+1+"\t");}
		}
		System.out.println();
	}

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		JunDuiDuiLie main = new JunDuiDuiLie();
		int n = sc.nextInt();
		for(int i=0;i<n;i++){
			int tmp = sc.nextInt();
			main.main(tmp);
		}
	}
}
