#include "bits/stdc++.h" #define int long long using namespace std; using ll = long long; using P = pair; const ll INF = (1LL << 61); ll mod = 998244353; signed main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; N--; if (N == 1) { cout << 1 << " " << 2 << " " << 1 << endl; return 0; } vectorB(N); int x; cin >> x; for (int i = 0; i < N; i++)cin >> B[i]; vector

A(N); for (int i = 0; i < N; i++)A[i] = { B[i], i + 2 }; sort(A.begin(), A.end()); cout << 1 << " " << A[N - 1].second << " "; int now = A[N - 1].second; for (int i = N - 3; i >= 0; i--) { cout << A[i].second << " "; } cout << A[N - 2].second << " "; cout << 1 << endl; return 0; }