Algorithm to distribute groups in pools for matches against each other