n = gets.to_i
arr = gets.chomp.split.map(&:to_i)
puts arr.join(" ")

1.upto(n - 1){|i|
    value = arr[i]
    j = i
    while j > 0 && arr[j - 1] > value
        arr[j] = arr[j - 1]
        j -= 1
    end
    arr[j] = value
    puts arr.join(" ")
}