func_code_string: #include <bits/stdc++.h>   using namespace std;   int u[1005], v[1005], fa[1005], n, m, k;   bool zt[1005][1005];   int getv(int x) {     if (x == fa[x]) return x;     fa[x] = getv(fa[x]);     return fa[x];   }   void merge(int x, int y) {     x = getv(x);     y = getv(y);     if (x == y) return;     if (x < y) {       int t = x;       x = y;       y = t;     }     fa[x] = y;     for (int i = 1; i <= m; i++) {       if (zt[x][i]) zt[y][i] = true;     }   }   unsigned long long ha(char zf[1005]) {     unsigned long long rt = 0;     for (int i = 0; zf[i]; i++) rt = rt * 13131 + zf[i];     return rt;   }   map<unsigned long long, int> mp;   char zf[1005];   int wz[1005], rw[1005], yw[1005];   int w2[1005], r2[1005], y2[1005];   bool b1[1005], b2[1005];   int main() {     scanf( %d%d%d , &n, &m, &k);     for (int i = 1; i <= n; i++) fa[i] = i;     for (int i = 1; i <= m; i++) scanf( %d%d , &u[i], &v[i]);     for (int i = 1; i <= k; i++) {       int a, s;       scanf( %s%d%d , zf, &a, &s);       rw[i] = a;       mp[ha(zf)] = i;       for (int j = 0; j < s; j++) {         int b;         scanf( %d , &b);         zt[a][b] = 1;         yw[b] = a;       }     }     for (int a = 1; a <= m; a++) {       for (int i = 1; i <= m; i++) {         if (!b1[i] && (zt[getv(u[i])][i] || zt[getv(v[i])][i])) {           merge(u[i], v[i]);           b1[i] = true;         }       }     }     for (int i = 1; i <= n; i++) wz[i] = getv(i);     for (int i = 1; i <= m; i++) yw[i] = getv(yw[i]);     for (int i = 1; i <= k; i++) rw[i] = getv(rw[i]);     for (int i = 1; i <= n; i++) {       fa[i] = i;       for (int j = 1; j <= m; j++) zt[i][j] = 0;     }     for (int i = 1; i <= k; i++) {       int a, s;       scanf( %s%d%d , zf, &a, &s);       r2[mp[ha(zf)]] = a;       for (int j = 0; j < s; j++) {         int b;         scanf( %d , &b);         zt[a][b] = 1;         y2[b] = a;       }     }     for (int a = 1; a <= m; a++) {       for (int i = 1; i <= m; i++) {         if (!b2[i] && (zt[getv(u[i])][i] || zt[getv(v[i])][i])) {           merge(u[i], v[i]);           b2[i] = true;         }       }     }     for (int i = 1; i <= n; i++) w2[i] = getv(i);     for (int i = 1; i <= m; i++) y2[i] = getv(y2[i]);     for (int i = 1; i <= k; i++) r2[i] = getv(r2[i]);     bool zd = false;     for (int i = 1; i <= n; i++) {       if (wz[i] != w2[i]) zd = true;     }     for (int i = 1; i <= k; i++) {       if (rw[i] != r2[i]) zd = true;     }     for (int i = 1; i <= m; i++) {       if (yw[i] != y2[i]) zd = true;     }     for (int i = 1; i <= m; i++) {       if (b1[i] != b2[i]) zd = true;     }     if (zd)       printf( NO );     else       printf( YES );     return 0;   }   