I don’t understand the problem.
The cows are not eager to get squished by the wormholes. Help them maximize the width of the least wide wormhole which they must use to sort themselves. It is guaranteed that it is possible for the cows to sort themselves.
What does the width of a wormhole mean/represent? What does it mean to get squished by the wormholes?