/*
The aim of public education is not to spread enlightenment at all; 
it is simply to reduce as many individuals as possible to the same
safe level, to breed a standard citizenry, to put down dissent and origianality.
-H.L. Mencken
*/

#include <iostream>
#include <vector>
using namespace std;

int main() {
	int T{ 0 }, n{ 0 };
	cin >> T;
	while (T--) {
		cin >> n;
		vector<int> output{ n };
		while (--n) {
			output.push_back(n);
			for (int i = 0; i < n; ++i)
				rotate(output.begin(), output.begin() + 1, output.end());
		}
		reverse(output.begin(), output.end());
		for (int i : output) cout << i << " ";
	}
}
