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

typedef vector <int> vi;
typedef pair< int ,int > pii;
#define all(v) v.begin(),v.end()
#define PB push_back
#define pairii pair<int, int>
#define pairll pair<long, long>
#define F first
#define S second
#define ll long long
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl; 
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

void dfs(int i, vector<bool> &vis, vector<vector<int>> adj){
    for(auto j: adj[i]){
        if(!vis[j]){
            vis[j] = true; 
            dfs(j, vis, adj); 
        }
    }
}


int main() {
 #ifndef ONLINE_JUDGE
 freopen("input.txt", "r", stdin);
 freopen("output.txt", "w", stdout); 
 #endif
 ios::sync_with_stdio(false); 
 cin.tie(nullptr); 
 cout.precision(10); 
int t; 
cin>>t; 
while(t--){
    int n ; 
    cin>>n; 
    for(int i=0; i<n-1; i++){
        cout<<i+2<<" "; 
    }
    cout<<1<<" "<<endl;
}
return 0; 
}