import string
all_letter = string.ascii_lowercase
def gen_dict():
result = {}
list_num_one = [ a_letter for a_letter in all_letter ]
list_num_two = [ i + j for i in all_letter for j in all_letter[all_letter.find(i)+1:]]
list_num_three = [ i + j + k for i in all_letter
for j in all_letter[all_letter.find(i)+1:]
for k in all_letter[all_letter.find(j)+1:]]
list_num_four = [ i + j + k + l for i in all_letter
for j in all_letter[all_letter.find(i)+1:]
for k in all_letter[all_letter.find(j)+1:]
for l in all_letter[all_letter.find(k)+1:]]
list_num_five = [ i + j + k + l + m for i in all_letter
for j in all_letter[all_letter.find(i)+1:]
for k in all_letter[all_letter.find(j)+1:]
for l in all_letter[all_letter.find(k)+1:]
for m in all_letter[all_letter.find(l)+1:]]
list_num_six = [ i + j + k + l + m + n for i in all_letter
for j in all_letter[all_letter.find(i)+1:]
for k in all_letter[all_letter.find(j)+1:]
for l in all_letter[all_letter.find(k)+1:]
for m in all_letter[all_letter.find(l)+1:]
for n in all_letter[all_letter.find(m)+1:]
]
for key,value in enumerate(list_num_one + list_num_two + list_num_three + list_num_four + list_num_five + list_num_six):
result.setdefault(key+1,value)
return result
my_dict = gen_dict()
value_to_get = 'abcdef'
for key,value in my_dict.iteritems():
if value == value_to_get:
print key