Beings come together and associate according to disposition. Those with wrong views come together and associate with those with wrong views, and similar for the other eight factors. Those with right views come together and associate with those with right views, and similar for the other eight factors.

Dasaṅgasutta sutta - The Tenfold Path

At Sāvatthi.

"Bhikkhus, beings come together and associate according to disposition. Those with wrong views come together and associate with those with wrong views; those with wrong intentions come together and associate with those with wrong intentions; those with wrong speech come together and associate with those with wrong speech; those with wrong actions come together and associate with those with wrong actions; those with wrong livelihood come together and associate with those with wrong livelihood; those with wrong effort come together and associate with those with wrong effort; those with wrong mindfulness come together and associate with those with wrong mindfulness; those with wrong collectedness come together and associate with those with wrong collectedness; those with wrong wisdom come together and associate with those with wrong wisdom; those with wrong liberation come together and associate with those with wrong liberation.

Those with right views come together and associate with those with right views; those with right intentions come together and associate with those with right intentions; those with right speech come together and associate with those with right speech; those with right actions come together and associate with those with right actions; those with right livelihood come together and associate with those with right livelihood; those with right effort come together and associate with those with right effort; those with right mindfulness come together and associate with those with right mindfulness; those with right collectedness come together and associate with those with right collectedness; those with right wisdom come together and associate with those with right wisdom; those with right liberation come together and associate with those with right liberation."