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

vector<int> solve(vector<int> a) {
    int n = a.size();
    vector<int> o(n);
    iota(o.begin(), o.end(), 0);
    sort(o.begin(), o.end(), [&](int i, int j) {
        return a[i] > a[j];
    });
    bool fl = 0;
    deque<int> rs;
    for (auto &el : o) {
        if (!fl) {
            rs.push_front(el);
        } else {
            rs.push_back(el);
        }
        fl ^= 1;
    }
    vector<int> go;
    for (auto &el : rs) {
        go.push_back(el);
    }
    return go;
}