Reconstruct reverse_mapping from mapping