#include <bits/stdc++.h>
using namespace std;

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