#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
using ll = long long;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin>>t;
    int len;
    while (t--)
    {
        cin>>len;
        for (int i = 2; i <= len; ++i)
        {
            cout<<i<<' ';
        }
        cout<<'1'<<endl;
        
    }
    return 0;
}