result = {}
d = {(1): 6, (2): 1, (3): 1, (4): 9, (5): 9, (6): 1}
for i, j in sorted(list(d.items()), key=lambda x: x[1]):
    if j not in result:
        result.update({j: [i]})
else:
    result.update({j: result[j] + [i]})
Grouping Python dictionary keys as a list and create a new dictionary with this list as a value