def insertionSort(a, n)
  printf("%s\n",a.join(" "))
  for i in 1..n-1 do
    v = a[i]
    j = i-1
    while j >= 0 && a[j] > v do
      a[j+1] = a[j]
      j -= 1
    end
    a[j+1] = v
    printf("%s\n",a.join(" "))
  end
end

n = gets.chomp.to_i
a = gets.chomp.split(" ").map{|x| x.to_i}
insertionSort(a,n)
