func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long maxn = 100005;   vector<pair<long long, char>> adj[maxn];   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     long long n, m;     cin >> n >> m;     for (long long i = 0; i < m; i++) {       long long u, v;       char c;       cin >> u >> v >> c;       adj[u].push_back({v, c});       adj[v].push_back({u, c});     }     vector<long long> res(2e5, 0);     for (long long c : { R ,  B }) {       vector<long long> vec;       bool vis[maxn], color[maxn];       for (long long i = 0; i <= n; i++) vis[i] = color[i] = false;       for (long long i = 1; i <= n; i++) {         if (vis[i]) continue;         vector<long long> s, t;         queue<long long> q;         q.push(i);         vis[i] = true;         while (!q.empty()) {           long long u = q.front();           q.pop();           if (color[u])             s.push_back(u);           else             t.push_back(u);           for (pair<long long, char> e : adj[u]) {             if (vis[e.first]) continue;             if (e.second == c)               color[e.first] = !color[u];             else               color[e.first] = color[u];             vis[e.first] = true;             q.push(e.first);           }         }         if (s.size() < t.size())           for (long long u : s) vec.push_back(u);         else           for (long long u : t) vec.push_back(u);       }       bool ok = true;       for (long long u = 1; u <= n; u++) {         for (pair<long long, char> e : adj[u]) {           if (e.second == c)             ok &= color[e.first] != color[u];           else             ok &= color[e.first] == color[u];         }       }       if (!ok) continue;       if (vec.size() < res.size()) res = vec;     }     if (res.size() == 2e5)       cout <<  -1 n ;     else {       cout << res.size() <<   n ;       for (long long i : res) cout << i <<    ;       cout <<   n ;     }   }   