def insertion_sort(data)
  1.upto(data.size - 1) { |i|
    puts data.join(' ')
    v = data[i]
    j = i - 1
    while j >= 0 and data[j] > v
      data[j + 1] = data[j]
      j -= 1
    end
    data[j + 1] = v
  }
  data
end

gets
data = gets.chomp.split(' ').map(&:to_i)
puts insertion_sort(data).join(' ')