Nature looks for similarly opposites: not too different, not too similar.

from The Myth of Monogamy by David P. Barash page 64 nonfiction ~1 min read

Don't be too quick, however, to conclude that EPCs always pay for themselves via outbreeding. There are, it appears, different strokes for dif­ ferent species: Just as there is a downside to too much inbreeding, excessive outbreeding, too, can carry costs. In at least one case, EPCs seem, paradox­ ically, to be a mechanism for keeping genes in the family instead of intro­ ducing new ones. In one bird species, the pied flycatcher, breeding pairs that are genetically quite different are more likely to have extra-pair young in their nests than are those who are genetically more similar. In this species, therefore, it appears that females are prone to mitigate the effects of extreme outbreeding, seeking EPCs with males who are somewhat more genetically similar to themselves. The problem with excessive outbreeding is that it might break up locally adapted gene combinations, which simply means that by combining individuals who are too different, the resulting offspring might fall between two stools, landing on neither. Females may well choose as mates those likely to meet the Goldlilocks criterion: a partner who is not too similar, and not too different, but Just Right. (It is also possible, inci­dentally, that when a male and female pied flycatcher are just "too differ­ ent" genetically, they are somewhat behaviorally incompatible as well, which would lead directly to more EPCs.)

—David P. Barash, The Myth of Monogamy, p. 64