{"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\u003eBob is an avid fan of the video game \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eLeague of Leesins\u003c/span\u003e\", and today he celebrates as the League of Leesins World Championship comes to an end! \u003c/p\u003e\u003cp\u003eThe tournament consisted of $$$n$$$ ($$$n \\ge 5$$$) teams around the world. Before the tournament starts, Bob has made a prediction of the rankings of each team, from $$$1$$$-st to $$$n$$$-th. After the final, he compared the prediction with the actual result and found out that the $$$i$$$-th team according to his prediction ended up at the $$$p_i$$$-th position ($$$1 \\le p_i \\le n$$$, all $$$p_i$$$ are unique). In other words, $$$p$$$ is a permutation of $$$1, 2, \\dots, n$$$.\u003c/p\u003e\u003cp\u003eAs Bob\u0027s favorite League player is the famous \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e3ga\u003c/span\u003e\", he decided to write down every $$$3$$$ consecutive elements of the permutation $$$p$$$. Formally, Bob created an array $$$q$$$ of $$$n-2$$$ triples, where $$$q_i \u003d (p_i, p_{i+1}, p_{i+2})$$$ for each $$$1 \\le i \\le n-2$$$. Bob was very proud of his array, so he showed it to his friend Alice.\u003c/p\u003e\u003cp\u003eAfter learning of Bob\u0027s array, Alice declared that she could retrieve the permutation $$$p$$$ even if Bob rearranges the elements of $$$q$$$ and the elements within each triple. Of course, Bob did not believe in such magic, so he did just the same as above to see Alice\u0027s respond.\u003c/p\u003e\u003cp\u003eFor example, if $$$n \u003d 5$$$ and $$$p \u003d [1, 4, 2, 3, 5]$$$, then the original array $$$q$$$ will be $$$[(1, 4, 2), (4, 2, 3), (2, 3, 5)]$$$. Bob can then rearrange the numbers within each triple and the positions of the triples to get $$$[(4, 3, 2), (2, 3, 5), (4, 1, 2)]$$$. Note that $$$[(1, 4, 2), (4, 2, 2), (3, 3, 5)]$$$ is not a valid rearrangement of $$$q$$$, as Bob is not allowed to swap numbers belong to different triples.\u003c/p\u003e\u003cp\u003eAs Alice\u0027s friend, you know for sure that Alice was just trying to show off, so you decided to save her some face by giving her \u003cspan class\u003d\"tex-font-style-bf\"\u003eany permutation\u003c/span\u003e $$$p$$$ that is consistent with the array $$$q$$$ she was given. \u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains a single integer $$$n$$$ ($$$5 \\le n \\le 10^5$$$)\u0026nbsp;— the size of permutation $$$p$$$.\u003c/p\u003e\u003cp\u003eThe $$$i$$$-th of the next $$$n-2$$$ lines contains $$$3$$$ integers $$$q_{i, 1}$$$, $$$q_{i, 2}$$$, $$$q_{i, 3}$$$ ($$$1 \\le q_{i, j} \\le n$$$)\u0026nbsp;— the elements of the $$$i$$$-th triple of the \u003cspan class\u003d\"tex-font-style-bf\"\u003erearranged\u003c/span\u003e (shuffled) array $$$q_i$$$, in random order. Remember, that the numbers within each triple can be rearranged and also the positions of the triples can be rearranged.\u003c/p\u003e\u003cp\u003eIt is guaranteed that there is at least one permutation $$$p$$$ that is consistent with the input. \u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint $$$n$$$ distinct integers $$$p_1, p_2, \\ldots, p_n$$$ ($$$1 \\le p_i \\le n$$$) such that $$$p$$$ is consistent with array $$$q$$$. \u003c/p\u003e\u003cp\u003eIf there are multiple answers, print any. \u003c/p\u003e"}},{"title":"Examples","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\n4 3 2\n2 3 5\n4 1 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 4 2 3 5 \n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}