#include<bits/stdc++.h>
using namespace std;

int T, n;

void solve()
{
	scanf("%d", &n);
	for(int i = 2; i <= n; i++)
		printf("%d ", i);
	printf("1\n");
}

signed main()
{

	scanf("%d", &T);
	while(T--)
	{
		solve();
	}

	return 0;
}
