Using frozenset and dict