#include // cout, endl, cin #include // string, to_string, stoi #include // vector #include // min, max, swap, sort, reverse, lower_bound, upper_bound #include // pair, make_pair #include // tuple, make_tuple #include // int64_t, int*_t #include // printf #include // map #include // queue, priority_queue #include // set #include // stack #include // deque #include // unordered_map #include // unordered_set #include // bitset #include // isupper, islower, isdigit, toupper, tolower #include // cout, endl, cin #include // string, to_string, stoi #include // vector #include // min, max, swap, sort, reverse, lower_bound, upper_bound #include // pair, make_pair #include // tuple, make_tuple #include // int64_t, int*_t #include // printf #include // map #include // queue, priority_queue #include // set #include // stack #include // deque #include // unordered_map #include // unordered_set #include // bitset #include // isupper, islower, isdigit, toupper, tolower using namespace std; using ll = long long; int main(){ int n; cin >> n; vector< pair > a; for(int i = 0 ; i < n ; i++){ ll b; cin >> b; pair p = make_pair(b , i + 1); a.push_back(p); } sort(a.begin(),a.end()); vector ans; for(int i = 0 ; 2 * i + 1 < n ; i++){ ans.push_back(a[2 * i + 1].second); } for(int i = (n - 1) / 2 ; 2 * i >= 0 ; i--){ ans.push_back(a[2 * i].second); } int memo; for(int i = 0 ; i < ans.size() ; i++){ if(ans[i] == 1){ memo = i; break; } } for(int i = 0 ; i < memo ; i++){ ans.push_back(ans[i]); } ans.erase(ans.begin(),ans.begin() + memo); for(int i = 0 ; i < ans.size() ; i++){ cout << ans[i] << " "; } cout << 1; return 0; }