//https://ncduy0303.github.io/Competitive-Programming/
#include<bits/stdc++.h>
using namespace std;
/*

 
*/
 
int main() {
    int t = 1;
    cin >> t;
    
    while(t--){
        long long int n;
        cin >> n;
        
        cout << n << " ";
        for(long long int i = 1; i <= n-1;i++){
            cout << i << " ";
        }
        cout << endl;
    }
 
 
    return 0;
        
    
}