#include <iostream>
#include<algorithm>
#include<map>
typedef long long int int64;
using namespace std;
int main() {
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	int t,x;
	cin>>t;
	while(t--){
		cin>>x;
		for(int i=1;i<=x-1;i++){
			cout<<i+1<<"\t";
		}
		cout<<1<<"\n";
	}
}	
