func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> tree[100005];   int bad[100005];   vector<int> result;   int SubTree[100005];   int dfs(int v, int pv) {     SubTree[v] = (int)(bad[v] == 1);     for (auto u : tree[v]) {       if (u == pv) continue;       SubTree[v] += dfs(u, v);     }     if (SubTree[v] == 1) result.push_back(v);     return SubTree[v];   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int N;     cin >> N;     for (int i = 0; i < N - 1; i++) {       int a, b, c;       cin >> a >> b >> c;       tree[a].push_back(b);       tree[b].push_back(a);       if (c == 2) {         bad[a] = bad[b] = 1;       }     }     dfs(1, 0);     cout << result.size() <<   n ;     for (auto i : result) cout << i <<    ;   }   