n = gets.to_i
a = gets.chomp
puts a
a = a.split(" ").map{|s| s.to_i}
for i in 1..n-1
  key = a[i]
  j = i - 1
  while j >= 0 && a[j] > key
    a[j+1] = a[j]
    j -= 1
  end
  a[j+1] = key
  for k in 0..n-1
    print(a[k])
    if k==n-1
      puts("")
    else
      print(" ")
    end
  end
end