import strutils, sequtils let N, A = stdin.readLine.split.map parseInt n = N[0] var a = A for i in 1 ..< 2 * n - 3: for p in countdown(n - 1, 0): let q = i - p try: if a[p] > a[q]: swap(a[p], a[q]) except: discard echo a