cut :: IM.IntMap Int -> IM.IntMap Int
cut m = IM.restrictKeys m vals
  where
    vals = IS.fromList $ IM.elems m
cut :: IM.IntMap Int -> IM.IntMap Int
cut m = IM.restrictKeys m vals
  where
    vals = IS.fromList $ IM.elems m
cut m = IM.restrictKeys m vals
  where
    vals = IS.fromList $ IM.elems m