#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld long double
#define IOS ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));
#define pi 3.14159265358979323846
#define mod 1000000007
#define INFi LLONG_MAX
int main()
{ 
    IOS;
    ll p;
    cin>>p;
    while(p--)
    {
        ll a,b,c,d,e;
        cin>>a;
        for(c=1;c<a;c++)
        {
            cout<<c+1<<" ";
        }
        cout<<1<<endl;
    }
}