python 7-lines
python\n    def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n        lang = [0] + list(map(set, languages))
```python\n    def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n        lang = [0] + list(map(set, languages))\n        uncom = set()    # someone may need learn new language\n        for a, b in friendships:\n            if not (lang[a] & lang[b]):\n                uncom.add(a)\n                uncom.add(b)\n        return min(sum(i not in lang[p] for p in uncom) for i in range(1, n+1))\n```
['Python']