input = gets.chomp().gsub(" ","")

size = input.size
rows = Math.sqrt(size).floor 
columns = Math.sqrt(size).ceil

i = 0
h = Hash.new('')
r = 0
while i < size
  if i % columns == 0
    r = 0
    h[r] += input[i]
  else
    h[r] += input[i]    
  end
 
  i += 1
  r += 1
end


h.keys.each do |k|
  print h[k]+" "
end
