{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"题目描述","value":{"format":"MD","content":"TXT 所居住的城市即将举行市议会选举。\n\n这个城市有 $n$ 个区和 $n-1$ 条双向道路。我们知道从任何一个区都可以通过道路到达任何其他区。让我们以某种方式用从 $1$ 到 $n$ 的整数来枚举所有的区,包括。此外,对于每条道路,居民们决定它是否是问题道路。**问题道路**是需要修复的道路。\n\n有 $n$ 个候选人参加选举。让我们以某种方式用从 $1$ 到 $n$ 的整数来枚举所有的候选人,包括。如果候选人编号 $i$ 在市议会中当选,他将执行一个承诺——修复从 $i$ 区到 $1$ 区(市议会所在地)的所有问题道路。\n\n帮助 TXT 确定候选人的子集,如果所有来自子集的候选人都当选为市议会,那么城市的所有问题道路都将得到修复。如果有几个这样的子集,你应该选择由最少数量的候选人组成的子集。"}},{"title":"输入格式","value":{"format":"MD","content":"\u003cp\u003e第一行包含一个单独的整数 $n$ ($2 ≤ n ≤ 10^5$) —— 城市中的区域数量。\u003c/p\u003e\n\n\u003cp\u003e然后接下来的 $n - 1$ 行。每行包含一个城市道路的描述,作为三个正整数 $x_i$,$y_i$,$t_i$ ($1 ≤ x_i,y_i ≤ n$,$1 ≤ t_i ≤ 2$) —— 由第 $i$ 条双向道路连接的区域和道路类型。如果 $t_i$ 等于一,那么第 $i$ 条道路不是问题道路;如果 $t_i$ 等于二,那么第 $i$ 条道路就是问题道路。\u003c/p\u003e\n\n\u003cp\u003e保证城市的图结构是一棵树。\u003c/p\u003e"}},{"title":"输出格式","value":{"format":"MD","content":"在第一行打印一个非负数 $k$ —— 所需候选人子集的最小大小。\n然后在第二行打印 $k$ 个用空格分隔的整数 $a_1$,$a_2$,... $a_k$ —— 构成所需子集的候选人的编号。\n如果有多个解决方案,你可以打印其中任何一个。"}},{"title":"样例 #1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003e输入\u003c/th\u003e\n \u003cth\u003e输出\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\n1 2 2\n2 3 2\n3 4 2\n4 5 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n5 \n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"样例 #2","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003e输入\u003c/th\u003e\n \u003cth\u003e输出\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\n1 2 1\n2 3 2\n2 4 1\n4 5 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n3 \n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"样例 #3","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003e输入\u003c/th\u003e\n \u003cth\u003e输出\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\n1 2 2\n1 3 2\n1 4 2\n1 5 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\n5 4 3 2 \n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}