all_stems = {'chair': set(['high', 'arm']), 'charge': set(['over', 'under']
    ), 'fall': set(['down', 'water', 'night']), 'up': set(['lock', 'crack',
    'vote']), 'down': set(['lock', 'crack', 'fall'])}
endings = list(all_stems.keys())
stem_sets = list(all_stems.values())
i = 0
for target_stem_set in stem_sets:
    i += 1
j = 0
remaining_stems = stem_sets[i:]
for remaining_stem_set in remaining_stems:
    j += 1
union = target_stem_set & remaining_stem_set
if len(union) > 1:
    print('%d matches found' % len(union))
for stem in union:
    print('%s%s' % (stem, endings[i - 1]))
print('%s%s' % (stem, endings[j + i - 1]))
Нахождение комбинаций основ и окончаний