func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, c, r[200001], u, v, i, t, k;   vector<long long> graph[200001], ans;   bool dfs(long long x, long long p) {     long long s = 0;     for (auto i : graph[x])       if (i != p) s += dfs(i, x);     if (r[x] && !s) ans.push_back(x);     return s + (long long)(r[x] && r[p]);   }   int main() {     cin >> n;     for (i = 0; i < n - 1; i++) {       cin >> u >> v >> t, graph[u].push_back(v), graph[v].push_back(u);       if (t == 2) r[u] = 1, r[v] = 1;     }     dfs(1, 0);     for (cout << ans.size() << endl, i = 0; i < ans.size(); i++)       cout << ans[i] <<    ;     return 0;   }   