n = gets.to_i
a = gets.split.map(&:to_i)
def insertionSort(a,n)
  for k in 0..n-2
    print "#{a[k]} "
  end
  puts a[n-1]
  for i in 1..n-1
    v = a[i]
    j = i-1
    while j >= 0 && a[j] > v
      a[j+1] = a[j]
      j -= 1
      a[j+1] = v
    end
    for k in 0..n-2
      print "#{a[k]} "
    end
    puts a[n-1]
  end
end
insertionSort(a,n)