#include <iostream>
#include <vector>
using namespace std;
int n,t;
vector <int> solve(vector <int> A) {
	vector <int> b(0);
	cin >> n;
	A.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	for (int i = A.size() - 2; i > 0; i -= 4) {
		b.push_back(i);
		b.push_back(i - 1);
	}
	b.push_back(A.size() - 1);
	for (int i = A.size() - 4; i > 0; i -= 4) {
		b.push_back(i);
		b.push_back(i - 1);
	}
	A = b;
	return A;
}
int main() {
	cin >> t;
	while (t--) {
		vector <int> a;
		solve(a);
	}
}