#include<bits/stdc++.h>
#include "partition.h"
using namespace std;
const int MAXN=1e7;
int a[MAXN+1];
vector<int> solve(vector<int> A) {
    vector<int>idx(A.size());
    int n=A.size();
    for(int i=0; i<A.size(); i++) {
        idx[i]=i;
        a[i]=A[i];
    }
    sort(idx.begin(),idx.end(),[](int x,int b) {
        return a[x]<a[b];
    });
    vector<int>res;
    for(int i=0;i<n;i++){
        res.push_back(idx[i]);
    }
    int idx1=n-1,idx2=(n+1)/2-1;
    swap(res[idx1],res[idx2]);
    return res;
}
/*
int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t ;
    for (int test=1; test<=t; test++) {
        int n;
        cin >> n ;
        vector <int> a(n);
        for (int i=0; i<n; i++) {
            cin >> a[i] ;
        }

        for (auto ind : solve(a)) {
            cout << ind << " ";
        }
        cout << endl ;
    }
    cout << endl ;
    return 0;
}
*/
