#include <iostream>
#include <vector>	
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#define pii pair<int,int>
using namespace std;
vector<int> solve(vector<int>A) {
	vector<int>ans;
	ans.push_back(A.size() - 1);
	for (int i = 0; i < A.size() - 1; i++) {
		ans.push_back(i);
	}	
	return ans;
}
int main() {
	int tt;
	cin >> tt;
	while (tt--) {
		int n;
		cin >> n;
		vector<int>a(n);
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}
		solve(a);
	}
}