Ultimately there's only 1 supreme rule and that is never to allow any 1 cell get overcharged or undercharged , so the only realistic rule is that all cells must be the same CAPACITY.
Many users also recommend that the specs be the same too , in addition to the number of uses, health, brand, age ect. This is an attempt to satisfy the realistic and the supreme rule.
They do not have to contain the same number of cells or be the same voltage.