#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
int64_t lol;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);cerr.tie(nullptr);
    int64_t testc=1;
    cin>>testc;
    while(testc--)
    {
        int n;cin>>n;
        for(int i=1;i<n;i++){
            cout<<i+1<<" ";
        }
        cout<<1<<endl;



    }
    return EXIT_SUCCESS;
}