putout = ->(ar) {puts ar.join(" ")}

gets
ar = gets.split.map(&:to_i)
n = ar.size

putout.(ar)
1.upto(n - 1) do |i|
  v = ar[i]
  j = i - 1
  while j >= 0 and ar[j] > v
    ar[j + 1] = ar[j]
    j -= 1
  end
  ar[j + 1] = v
  putout.(ar)
end

