func_code_string: #include <bits/stdc++.h>   using namespace std;   struct node {     string name;     int version;   };   int main(void) {     int n;     cin >> n;     map<pair<string, int>, vector<pair<string, int> > > m;     pair<string, int> init;     for (int i = 0; i < n; i++) {       pair<string, int> cur;       cin >> cur.first >> cur.second;       cur.second *= -1;       if (i == 0) init = cur;       int k;       cin >> k;       for (int j = 0; j < k; j++) {         pair<string, int> node;         cin >> node.first >> node.second;         node.second *= -1;         m[cur].push_back(node);       }     }     set<string> names;     set<pair<string, int> > ans;     set<pair<string, int> > layer;     names.insert(init.first);     layer.insert(init);     while (!layer.empty()) {       set<pair<string, int> > new_layer;       for (set<pair<string, int> >::iterator it = layer.begin();            it != layer.end(); it++) {         for (int k = 0; k < m[*it].size(); k++) {           new_layer.insert(m[*it][k]);         }       }       layer.clear();       for (set<pair<string, int> >::iterator it = new_layer.begin();            it != new_layer.end(); it++) {         if (names.find(it->first) != names.end()) continue;         names.insert(it->first);         ans.insert(*it);         layer.insert(*it);       }     }     cout << ans.size() << endl;     for (set<pair<string, int> >::iterator it = ans.begin(); it != ans.end();          it++) {       cout << it->first <<     << -it->second << endl;     }     return 0;   }   