Level sort (the first wave)