We are given a list of items. Each item belongs to a stack. We want to position these items in a square and minimize the side of the square. In order to do this, we will put each stack on a separate row and only use another column when we have enough room. We won't create another column if doing so would increase the side of the square.