#include<iostream>
using namespace std;

int main(){
    int t, n, i;
    cin >> t;
    while(t--){
        cin >> n;
        for(i=0;i<n-1;i++){
            cout << i+2 << " ";
        }
        cout << "1";
        cout << endl;
    }
}