#include using namespace std; int main(){ int N; cin >> N; vector A(N); for (int i = 0; i < N; i++){ cin >> A[i]; } vector> P(N); for (int i = 0; i < N; i++){ P[i] = make_pair(A[i], i); } sort(P.begin(), P.end()); vector p(N); for (int i = 0; i < N; i++){ p[i] = P[i].second; } vector B; if (N % 2 == 1){ for (int i = 0; i < N; i += 2){ B.push_back(p[i]); } for (int i = N - 2; i >= 1; i -= 2){ B.push_back(p[i]); } } else { for (int i = 0; i < N; i += 2){ B.push_back(p[i]); } for (int i = N - 1; i >= 1; i -= 2){ B.push_back(p[i]); } } int x; for (int i = 0; i < N; i++){ if (B[i] == 0){ x = i; } } vector ans; for (int i = 0; i <= N; i++){ ans.push_back(B[(i + x) % N]); } for (int i = 0; i <= N; i++){ cout << ans[i] + 1; if (i < N){ cout << ' '; } } cout << endl; }