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

vector<int> solve(vector<int> a)
{
    int n = a.size();
    vector<pair<int, int>> v;
    for (int i = 0; i < n; i++) v.push_back({a[i], i});
    sort(v.begin(), v.end());

    deque<int> ans;
    while (!v.empty())
    {
        ans.push_front(v.back().second);
        v.pop_back();
        ans.push_back(v.back().second);
        v.pop_back();
    }
    return vector<int>(ans.begin(), ans.end());
}