#include <bits/stdc++.h>
using namespace std;
std::vector<int> solve(std::vector<int> A)
{
    vector < pair <int, int> > v;
    for(int i = 0; i < A.size(); i++)
    {
        v.push_back({A[i], i});
    }
    sort(v.begin(), v.end());
    vector <int> ans;
    int l = 0, r = v.size()-1;
    while(l <= r)
    {
        ans.push_back(v[l].second);
        if(r != l)
            ans.push_back(v[r].second);
        l++;
        r--;
    }
    return ans;
}
