Python 3, Greedy, 95% time
\nclass Solution:\n    def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n        # For all friends who canno
```\nclass Solution:\n    def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n        # For all friends who cannot chat, find out the most common language they speak\n        # Then teach the language to those unable to speak it, and return how many being taught\n        \n        friendships = [(u-1, v-1) for u, v in friendships] # convert to indices\n        ls = [set(l) for l in languages] # make sets\n        visited = set()\n        ct = Counter()\n        \n        for u, v in friendships:\n            if not (ls[u] & ls[v]):\n                if u not in visited:\n                    visited.add(u)\n                    for l in ls[u]:\n                        ct[l] += 1\n                if v not in visited:\n                    visited.add(v)\n                    for l in ls[v]:\n                        ct[l] += 1\n        if not ct:\n            return 0\n        \n        # The most common language among all friends who cannot communicate\n        target = sorted(list(ct.items()), key = lambda x: x[1])[-1][0]\n        \n        ans = 0\n        for x in visited: # among all friends unable to chat\n            if target not in ls[x]: # if x doesnt speak target, teach it to x\n                ans += 1\n        return ans\n```
['Greedy']