Use sets to get friends who can't communicate
\nclass Solution:\n    def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n        hmap = {}\n        for i, l
```\nclass Solution:\n    def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n        hmap = {}\n        for i, l_list in enumerate(languages):\n            hmap[i+1] = set()\n            for item in l_list:\n                hmap[i+1].add(item)\n        \n        mis_friend = set()\n        \n        for friend in friendships:\n            a, b = friend[:]\n            if not len(hmap[a].intersection(hmap[b])):\n                mis_friend.add(a)\n                mis_friend.add(b)\n                \n        res = float(\'inf\')\n        for lang in range(1, n+1):\n            count = 0\n            for fri in mis_friend:\n                if lang not in hmap[fri]:\n                    count+=1\n            res = min(res, count)\n        return res\n```
['Ordered Set', 'Python']