#include <iostream>
using namespace std;
int n,t;
long long a[2000000];
int main() {
	cin >> t;
	while (t--) {
		cin >> n;
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}
		for (int i = n - 2; i > 0; i -= 4) {
			cout << i << " " << i-1 << " ";
		}
		cout << n-1 << " ";
		for (int i = n - 4; i > 0; i -= 4) {
			cout << i << " " << i-1 << " ";
		}
		cout << 0 << "\n";
	}
}