C++ Self Explanatory Code
\nclass Solution {\npublic:\n    int minimumTeachings(int n, vector<vector<int>>& languages, vector<vector<int>>& friendships) {\n        int m = languages.size
```\nclass Solution {\npublic:\n    int minimumTeachings(int n, vector<vector<int>>& languages, vector<vector<int>>& friendships) {\n        int m = languages.size();\n        vector<set<int>> lang(m+1);\n        for(int i=0; i<languages.size(); i++){\n            for(int j=0;j<languages[i].size();j++){\n                lang[i+1].insert(languages[i][j]);\n            }\n        }\n        vector<vector<int>> uncommon;\n        for(int j=0; j<friendships.size(); j++){\n            int u =friendships[j][0], v = friendships[j][1];\n            bool cmn = false;\n            for(auto k:lang[u]){\n                if(lang[v].find(k)!=lang[v].end()){\n                    cmn=true;\n                    break;\n                }\n            }\n            if(cmn){\n                continue;\n            }\n            uncommon.push_back(friendships[j]);\n        }\n        \n        \n        int ans = INT_MAX;\n        for(int i=1; i<=n; i++){\n            int cnt = 0;\n            set<int> s;\n            for(int j=0; j<uncommon.size(); j++){\n                int u =uncommon[j][0], v = uncommon[j][1];\n                if(lang[u].find(i)==lang[u].end()){\n                    s.insert(u);\n                }\n                if(lang[v].find(i)==lang[v].end()){\n                    s.insert(v);\n                }\n                \n            }\n            ans = min(ans, (int)s.size());\n        }\n        return ans;\n    }\n};\n\n```
[]