#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long

void solve()
{
    int n;
    cin>>n;
    int arr[n+1];

    for(int i=0;i<n;i++)
    {
        arr[i] = i+1;
    }

    int mid = n/2;
    
    if(n%2==0)
    {
    for(int i=n-1;i>=0;i--)
    {
        cout<<arr[i]<<" ";
    }
    cout<<endl;
    }
    else
    {
        for(int i=n-1;i>mid;i--)
        {
            cout<<arr[i]<<" ";
        }

        for(int i=0;i<=mid;i++)
        {
            cout<<arr[i]<<" ";
        }
        cout<<endl;
    }
}
int main(){
    int test;
    cin>>test;
    for(int i = 1; i <= test; i++){
        solve();
    }
return 0;
}
