#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //eolibraries #define lnf 3999999999999999999 #define inf 999999999 #define PI 3.14159265359 #define endl "\n" #define fi first #define se second #define pb push_back #define eb emplace_back #define ll long long #define all(c) (c).begin(),(c).end() #define sz(c) (int)(c).size() #define mkp(a,b) make_pair(a,b) #define make_unique(a) sort(all(a)),a.erase(unique(all(a)),a.end()) #define rsz(a,n) a.resize(n) #define pii pair #define rep(i,n) for(int i = 0 ; i < n ; i++) #define drep(i,n) for(int i = n-1 ; i >= 0 ; i--) #define crep(i,x,n) for(int i = x ; i < n ; i++) #define vi vector #define vec(...) vector<__VA_ARGS__> #define rsz(a,n) a.resize(n) #define rszv(a,n,v) a.resize(n,v) #define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); //eodefine using namespace std; const int max_n = 103002; int n; vec(pii) a; int main(){ fcin; cin>>n; rep(i,n) { int x;cin>>x; a.pb({x,i}); } sort(all(a)); reverse(all(a)); deque dq; rep(i,n) { if(i%2==0) dq.push_front(a[i].se); else dq.pb(a[i].se); } int pos=-1; rep(i,sz(dq)) if(dq[i]==0)pos=i; vi ans; crep(i,pos,n) ans.pb(dq[i]); rep(i,pos+1) ans.pb(dq[i]); for(auto x : ans) cout << x + 1 << " "; /* */ return 0; }