func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, k, x[1010], y[1010], i, j, l, r[1010], w[1010], dad[1010], ss, flag,       use[1010], ke, t;   int rr[1010], ww[1010], use1[1010];   char s1[1010][20], s[20];   int fi(int x) { return dad[x] == x ? x : dad[x] = fi(dad[x]); }   int main() {     scanf( %d%d%d , &n, &m, &k);     for (i = 1; i <= n; i++) dad[i] = i;     for (i = 1; i <= m; i++) scanf( %d%d , &x[i], &y[i]);     for (i = 1; i <= k; i++) {       scanf( %s%d%d , s1[i], &r[i], &ss);       for (j = 1; j <= ss; j++) scanf( %d , &t), w[t] = i;     }     for (; !flag;) {       flag = 1;       for (i = 1; i <= m; i++)         if (!use[i])           if ((fi(x[i]) == fi(r[w[i]])) || (fi(y[i]) == fi(r[w[i]]))) {             flag = 0, use[i] = 1;             if (fi(x[i]) != fi(y[i])) dad[fi(x[i])] = fi(y[i]);           }     }     for (i = 1; i <= k; i++) {       scanf( %s%d%d , s, &rr[i], &ss);       for (j = 1; j <= k; j++)         if (!strcmp(s1[j], s)) break;       if (fi(rr[i]) != fi(r[j])) {         printf( NO n );         return 0;       }       for (l = 1; l <= ss; l++) {         scanf( %d , &ke);         ww[ke] = i;         if (fi(r[w[ke]]) != fi(rr[i])) {           printf( NO n );           return 0;         }       }     }     for (i = 1; i <= n; i++) dad[i] = i;     for (i = 1; i <= m; i++) use1[i] = use[i], use[i] = 0;     for (flag = 0; !flag;) {       flag = 1;       for (i = 1; i <= m; i++)         if (!use[i])           if ((fi(x[i]) == fi(rr[ww[i]])) || (fi(y[i]) == fi(rr[ww[i]]))) {             flag = 0, use[i] = 1;             if (fi(x[i]) != fi(y[i])) dad[fi(x[i])] = fi(y[i]);           }     }     for (i = 1; i <= m; i++)       if (use1[i] != use[i]) {         printf( NO n );         return 0;       }     printf( YES n );   }   