Inverting a dictionary [1]