import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); City[] cities = new City[n]; for (int i = 0; i < n; i++) { cities[i] = new City(i + 1, sc.nextInt()); } Arrays.sort(cities); ArrayList deq = new ArrayList<>(); for (int i = 0; i < n; i++) { if (i % 2 == 0) { deq.add(0, cities[i]); } else { deq.add(cities[i]); } } for (int i = 0; i < n; i++) { if (deq.get(i).idx > 1) { continue; } StringBuilder sb = new StringBuilder(); for (int j = 0; j < n; j++) { sb.append(deq.get((i + j) % n).idx).append(" "); } sb.append(1); System.out.println(sb); return; } } static class City implements Comparable { int idx; int value; public City(int idx, int value) { this.idx = idx; this.value = value; } public int compareTo(City another) { return value - another.value; } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }