func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, m, q;   long long siz[100005];   long long par[100005];   string s;   unordered_map<string, long long> idx;   vector<pair<long long, long long> > e[100005];   long long ans[100005];   long long dis[100005];   pair<long long, pair<long long, long long> > edges[100005];   long long find_set(long long a) {     if (a == par[a]) return a;     return par[a] = find_set(par[a]);   }   void union_set(long long a, long long b) {     a = find_set(a);     b = find_set(b);     if (a != b) {       if (siz[a] < siz[b]) swap(a, b);       par[b] = a;       siz[a] += siz[b];     }   }   void dfs(long long u, long long len, long long par) {     dis[u] = len;     for (auto i : e[u]) {       if (i.first != par) dfs(i.first, len + i.second, u);     }   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m >> q;     for (long long i = 0; i < n; i++) {       cin >> s;       idx[s] = i;       par[i] = i;       siz[i] = 1;     }     for (long long i = 0; i < m; i++) {       long long type;       string a, b;       cin >> type >> a >> b;       long long u = idx[a];       long long v = idx[b];       edges[i] = {type, {u, v}};       long long uRep = find_set(u);       long long vRep = find_set(v);       if (uRep == vRep) continue;       union_set(uRep, vRep);       if (type == 1)         e[u].push_back({v, 0}), e[v].push_back({u, 0});       else         e[u].push_back({v, 1}), e[v].push_back({u, 1});       ans[i] = 1;     }     memset(dis, -1, sizeof(dis));     for (long long i = 0; i < n; i++) {       if (dis[i] == -1) {         long long iRep = find_set(i);         dfs(iRep, 0, -1);       }     }     for (long long i = 0; i < m; i++) {       if (ans[i])         cout <<  YES n ;       else {         long long u = edges[i].second.first;         long long v = edges[i].second.second;         long long type = edges[i].first;         long long real_type;         if (dis[u] % 2 == dis[v] % 2)           real_type = 1;         else           real_type = 2;         if (real_type == type)           cout <<  YES n ;         else           cout <<  NO n ;       }     }     while (q--) {       string a, b;       cin >> a >> b;       long long u = idx[a];       long long v = idx[b];       long long uRep = find_set(u);       long long vRep = find_set(v);       if (uRep != vRep)         cout << 3 << endl;       else {         if (dis[u] % 2 == dis[v] % 2)           cout << 1 << endl;         else           cout << 2 << endl;       }     }     return 0;   }   