datas =$stdin.read.split("\n")
n = datas[0].to_i
datas = datas[1].split(" ")
datas.map! do |x|
  x.to_i
end

for i in 1..n - 1 do
  v = datas[i]
  j = i - 1
  while j >= 0 && datas[j] > v do
    datas[j + 1] = datas[j]
    j -= 1
  end
  datas[j + 1] = v
  p datas
end
