Open1

alg

fujitani sorafujitani sora
n = gets.to_i
lines = gets.split(" ").map(&:to_i)


def exec(lines)
  i = 0

  while i < lines.length - 1
    indexMin = i
    k = i + 1
    while k < lines.length
       if lines[indexMin] > lines[k] 
        indexMin = k
      end

      k += 1
    end

    w = lines[i]
    lines[i] = lines[indexMin]
    lines[indexMin] = w
    i += 1
    puts lines.join(" ")
  end
  
end

exec(lines)