def geta(n=0)
  return $stdin.gets.to_i if n==0
  ar = []
  n.times do 
    ar << $stdin.gets.chomp.split
  end
  return ar.flatten(1) if n<=1
  return ar
end

def insert(idx)
  return if idx-1<0
  0.step(idx-1) do |i|
    if @ar[i] > @ar[idx]
      n = @ar.delete_at(idx)
      @ar.insert( i, n)
      return
    end
  end
end


n = geta(0)
@ar = geta(1).to_i

n.times do |i|
  insert(i)
  puts @ar.join(" ")
end
