using System; using System.Linq; using System.Text; using System.Collections.Generic; namespace Yuki { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int[] a = Console.ReadLine().Split().Select(z => int.Parse(z)).ToArray(); for (int i = 1; i < 2 * n - 3; i++) { var lip = new List(); var liq = new List(); for (int p = 0; p < n - 1; p++) { bool f = true; for (int q = p + 1; q < n; q++) { if (p + q == i) { lip.Add(p); liq.Add(q); break; } } } for (int j = 0; j < lip.Count; j++) { if (a[lip[j]] > a[liq[j]]) { int w = a[lip[j]]; a[lip[j]] = a[liq[j]]; a[liq[j]] = w; } } } var sb = new StringBuilder(); foreach (var item in a) { sb.Append(item.ToString() + " "); } Console.WriteLine(sb.ToString().Trim()); } } }