{"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\u003e在暑期信息学校,如果一个学生表现不好,老师会在他的徽章上打一个洞。今天,一位老师抓住了一群学生又在捣乱。\u003c/p\u003e\u003cp\u003e假设这些学生的编号从$$$1$$$到$$$n$$$。老师来到学生$$$a$$$面前,在他的徽章上打了一个洞。然而,这位学生声称真正的罪魁祸首是另一个学生$$$p_a$$$。\u003c/p\u003e\u003cp\u003e接着,老师来到学生$$$p_a$$$面前,也在他的徽章上打了一个洞。学生回答说,真正的罪魁祸首是学生$$$p_{p_a}$$$。\u003c/p\u003e\u003cp\u003e这个过程持续了一段时间,但由于学生数量是有限的,最终老师来到了已经被打过洞的学生面前。\u003c/p\u003e\u003cp\u003e老师在这位学生的徽章上再打了一个洞,决定结束这个过程,然后去桑拿。\u003c/p\u003e\u003cp\u003e你不知道老师抓到的第一个学生是谁。但是你知道所有编号$$$p_i$$$。你的任务是找出对于每个学生$$$a$$$,如果第一个被抓到的学生是$$$a$$$,那么谁会是徽章上有两个洞的学生。\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e输入的第一行包含唯一的整数$$$n$$$($$$1 \\le n \\le 1000$$$)— 被调皮的学生的数量。\u003c/p\u003e\u003cp\u003e第二行包含$$$n$$$个整数$$$p_1$$$,..., $$$p_n$$$($$$1 \\le p_i \\le n$$$),其中$$$p_i$$$表示被学生$$$i$$$向老师举报。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e对于每个学生$$$a$$$从$$$1$$$到$$$n$$$,打印出如果$$$a$$$是老师抓到的第一个学生,那么谁会有徽章上有两个洞。\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\u003e3\n2 3 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2 2 3 \n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"示例2","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\u003e3\n1 2 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 2 3 \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\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/c52153cf50077d234038943e2f65421a?v\u003d1706336874\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003c/center\u003e\u003cp\u003e当$$$a \u003d 1$$$时,老师依次来到学生$$$1$$$、$$$2$$$、$$$3$$$、$$$2$$$,这时学生$$$2$$$会是徽章上有两个洞的学生。\u003c/p\u003e\u003cp\u003e当$$$a \u003d 2$$$时,老师依次来到学生$$$2$$$、$$$3$$$、$$$2$$$,这时学生$$$2$$$会是徽章上有两个洞的学生。当$$$a \u003d 3$$$时,老师会依次来到学生$$$3$$$、$$$2$$$、$$$3$$$,学生$$$3$$$会是徽章上有两个洞的学生。\u003c/p\u003e\u003cp\u003e对于第二个示例测试用例,很明显无论老师从哪个学生开始,那个学生都会是徽章上有两个洞的学生。\u003c/p\u003e"}}]}