def insertionSort(_A, _N)
  printf "%s\n", _A.join(" ")
  for i in 1.._N-1
    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.to_i
arr = gets.chomp.split.map(&:to_i)
insertionSort(arr, n)