Simple C++ Solution
\nclass Solution {\npublic:\n    int minimumTeachings(int n, vector<vector<int>>& languages, vector<vector<int>>& friendships) {\n        set<int> arr;\n       
```\nclass Solution {\npublic:\n    int minimumTeachings(int n, vector<vector<int>>& languages, vector<vector<int>>& friendships) {\n        set<int> arr;\n        \n        //to store languages known by ith user\n        unordered_map<int, map<int, int>> mp;\n        \n        for(int i = 0; i < languages.size(); i++) \n            for(auto x : languages[i])\n                mp[i+1][x]++;\n        \n        for(int i = 0; i < friendships.size(); i++) {\n            int x = friendships[i][0], y = friendships[i][1];\n            int flag = 0;\n            \n            for(int cnt = 1; cnt <= n; cnt++) {\n                //do not insert into set if both can communicate with each other\n                if(mp[x][cnt] and mp[y][cnt]) {\n                    flag = 1;\n                    break;\n                }\n            }\n            \n            if(flag == 0) \n                arr.insert(x), arr.insert(y);\n        }\n        \n        int cnta = INT_MAX;\n        \n        //here logic is that if the friendship set has any two mutually exclusive tuples than \n        //they have to know the common language as the whole network has to communicate\n        //so checking for each language check how many persons know it and take the minimum number needed to teach one\n        \n        //check how much persons we need to teach for each language\n        for(int cnt = 1; cnt <= n; cnt++) {\n            int maxi = 0;\n            for(auto x : arr) \n                if(!mp[x][cnt])\n                    maxi++;\n        \n            cnta = min(cnta, maxi);\n        }\n        \n        return cnta;\n    }\n};\n```
[]