{"trustable":true,"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":"HTML","content":"\u003cp\u003eAsya非常喜欢动物。最近,她购买了$$$n$$$只小猫,将它们从$$$1$$$到$$$n$$$编号,然后将它们放入笼子中。笼子由一排$$$n$$$个单元格组成,从左到右用整数从$$$1$$$到$$$n$$$编号。相邻单元格之间有半透明的隔板,因此最初有$$$n - 1$$$个隔板。最初,每个单元格中都有一只小猫。\u003c/p\u003e\u003cp\u003e观察小猫后,Asya注意到它们非常友好,经常有相邻单元格中的一对小猫想要一起玩。因此,Asya开始移除相邻单元格之间的隔板。特别是在第$$$i$$$天,Asya:\u003c/p\u003e\u003cul\u003e \u003cli\u003e注意到位于相邻单元格中的小猫$$$x_i$$$和$$$y_i$$$想要一起玩。 \u003c/li\u003e\u003cli\u003e移除了这两个单元格之间的隔板,有效地创建了一个单元格,其中包含了两个原始单元格中的所有小猫。 \u003c/li\u003e\u003c/ul\u003e\u003cp\u003e由于Asya从未重新放置过隔板,在$$$n - 1$$$天后,笼子中只剩下一个单元格,其中包含了所有小猫。\u003c/p\u003e\u003cp\u003e对于每一天,Asya记得想要一起玩的小猫的编号$$$x_i$$$和$$$y_i$$$,但她不记得最初是如何将小猫放入笼子中的。请帮助她找到可能的小猫最初的排列方式,共有$$$n$$$个单元格。\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e第一行包含一个整数$$$n$$$($$$2 \\le n \\le 150\\,000$$$)— 小猫的数量。\u003c/p\u003e\u003cp\u003e接下来的$$$n - 1$$$行中,每行包含整数$$$x_i$$$和$$$y_i$$$($$$1 \\le x_i, y_i \\le n$$$,$$$x_i \\ne y_i$$$)— 由于对应天数的边界移除而聚在一起的小猫的索引。\u003c/p\u003e\u003cp\u003e保证在这一天之前,小猫$$$x_i$$$和$$$y_i$$$在不同的单元格中。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e对于从$$$1$$$到$$$n$$$的每个单元格,打印一个整数— 最初在其中的小猫的索引,从$$$1$$$到$$$n$$$。\u003c/p\u003e\u003cp\u003e所有打印的整数必须是不同的。\u003c/p\u003e\u003cp\u003e保证至少有一个可能的答案。如果存在多个可能的答案,请打印其中任意一个。\u003c/p\u003e"}},{"title":"示例1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\n1 4\n2 5\n3 1\n4 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3 1 4 2 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"注意","value":{"format":"HTML","content":"\u003cp\u003e示例的答案包含了几种可能的小猫最初排列方式之一。\u003c/p\u003e\u003cp\u003e下面的图片展示了这种初始排列方式是如何将单元格合并的。请注意,每天想要一起玩的小猫实际上是在\u003cspan class\u003d\"tex-font-style-bf\"\u003e相邻单元格\u003c/span\u003e中的。\u003c/p\u003e\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/c08333a4a070339d7871fe4eb1b61b1b?v\u003d1711075482\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003c/center\u003e"}}]}