{"trustable":true,"prependHtml":"\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 async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e五百年后,龙珠的数量突然增加,孙悟空很难将所有的龙珠聚集在一起。\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/2e977ab8d9049f352ffbec0c1897eaff?v\u003d1708965104\"\u003e\u003c/center\u003e\u003cbr\u003e他的国家有N个城市,世界上正好有N颗龙珠。一开始,对于第i颗龙珠,神龙会将其放在第i个城市。经过多年,一些城市的龙珠会被运送到其他城市。为了节省体力,孙悟空计划乘坐筋斗云,一朵神奇的飞行云,来收集龙珠。\u003cbr\u003e每次孙悟空收集一颗龙珠的信息时,他会询问你关于那颗龙珠的信息。你必须告诉他这颗龙珠位于哪个城市,那个城市有多少颗龙珠,还需要告诉他这颗龙珠到目前为止被运输了多少次。\u003c/div\u003e"}},{"title":"输入","value":{"format":"HTML","content":"输入的第一行是一个正整数T(0 \u003c T \u003c\u003d 100)。\u003cbr\u003e对于每个测试用例,第一行包含两个整数:N和Q (2 \u003c\u003d N \u003c\u003d 10000, 2 \u003c\u003d Q \u003c\u003d 10000)。\u003cbr\u003e接下来的Q行中,每行包含一个事实或一个问题,格式如下:\u003cbr\u003e\u0026nbsp;\u0026nbsp;T A B:所有与A在同一城市的龙珠都被运送到了B所在的城市。可以假设这两个城市不同。\u003cbr\u003e\u0026nbsp;\u0026nbsp;Q A:孙悟空想知道X(第A颗龙珠所在的城市的编号)、Y(该城市中龙珠的数量)和Z(第A颗龙珠的运输次数)。 (1 \u003c\u003d A, B \u003c\u003d N)"}},{"title":"输出","value":{"format":"HTML","content":"对于每个测试用例,输出样例输出格式的测试用例编号。然后对于每个查询,输出一个包含三个整数X Y Z的行,以空格分隔。"}},{"title":"样例","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\u003e2\r\n3 3\r\nT 1 2\r\nT 3 2\r\nQ 2\r\n3 4\r\nT 1 2\r\nQ 1\r\nT 1 3\r\nQ 1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1:\r\n2 3 0\r\nCase 2:\r\n2 2 1\r\n3 3 2\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}