#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; using ll = long long; using ld = long double; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N; cin >> N; vector> A(N); rep(i,N) { int a; cin >> a; A[i] = {a, i}; } sort(A.begin(), A.end()); deque q; rep(i,N) { if(i % 2 == 0) q.push_front(A[i].second); else q.push_back(A[i].second); } while(q.front() != 0) { q.push_back(q.front()); q.pop_front(); } q.push_back(0); rep(i,N+1) cout << q[i] + 1 << " \n"[i == N]; }