func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mxn = 1e3 + 5;   int Set(int N, int pos) { return N = N | (1 << pos); }   int reset(int N, int pos) { return N = N & ~(1 << pos); }   bool check(int N, int pos) { return (bool)(N & (1 << pos)); }   struct data {     int U;     int V;     int idx;   };   vector<data> es, em;   vector<int> ans;   int par[mxn];   int unode[100005];   int vnode[100005];   int Find(int p) {     if (p == par[p]) return p;     return par[p] = Find(par[p]);   }   bool merge(int u, int v) {     u = Find(u);     v = Find(v);     if (u == v) return false;     par[v] = u;     return true;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     for (int i = 0; i < mxn; i++) par[i] = i;     int n, m;     cin >> n >> m;     for (int i = 0; i < m; i++) {       int u, v;       char c;       cin >> u >> v >> c;       unode[i] = u;       vnode[i] = v;       if (c ==  S )         es.push_back({u, v, i});       else {         em.push_back({u, v, i});         merge(u, v);       }     }     if (!(n & 1)) {       cout << -1 <<   n ;       return 0;     }     int cnt = 0;     for (auto i : es) {       if (merge(i.U, i.V)) {         ans.push_back(i.idx);         cnt++;       }     }     for (int i = 0; i < mxn; i++) par[i] = i;     for (auto i : ans) merge(unode[i], vnode[i]);     int tt = (n - 1) >> 1;     for (auto i : es) {       if (cnt == tt) break;       if (merge(i.U, i.V)) {         ans.push_back(i.idx);         cnt++;       }     }     if (cnt != tt) {       cout << -1 <<   n ;       return 0;     }     cnt = 0;     for (auto i : em) {       if (cnt == tt) break;       if (merge(i.U, i.V)) {         ans.push_back(i.idx);         cnt++;       }     }     if (cnt != tt) {       cout << -1 <<   n ;       return 0;     }     cout << n - 1 <<   n ;     for (auto i : ans) cout << i + 1 <<    ;     return 0;   }   