n = gets.to_i
numbers = gets.split.map(&:to_i)
for i in 0..(n-1) do
  target = numbers[i]
  c = i - 1
  while c >= 0 && target < numbers[c]
    numbers[c+1] = numbers[c]
    c -= 1
  end
  numbers[c+1] = target
  puts numbers.join(" ")
end
