class String
  def to_ia
    self.split(/\s+/).map {|s| s.to_i}
  end
end

def solve(ary)
  puts ary.join(' ')
  n = ary.size
  (1...n).each do |i|
    v = ary[i]
    j = i-1
    while j >= 0 and ary[j] > v
      ary[j+1] = ary[j]
      j -= 1
    end
    ary[j+1] = v
    puts ary.join(' ')
  end
end

STDIN.readline
solve(STDIN.readline.to_ia)