{"trustable":false,"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":"MD","content":"一年一度的国际大学生旅游大会又开始啦!n 个 tourist 开始了他们的旅行!\n最初,每个 tourist 都在自己的城市里,且每个 tourist 都住在不同的城市里。\n随着大会的进行,一些城市里的 tourist 会跑到另一些 tourist 所在的城市玩,作为大会的主办方,掌握参会者的行踪是很重要的,所以请你设计一个程序维护以下两个操作:\n1. T A B:所有和 A 在一个城市里的 tourist 都跑到了 B 所在的城市里(数据保证 A 和 B 不位于同一个城市)。\n2. Q A:输出三个整数,分别是 A所在的城市、A所在的城市有多少 Tourist、A旅游了几次(进行了几次城市间的移动)"}},{"title":"Input","value":{"format":"MD","content":"第一行是一个整数 T,(1 \u003c\u003d T \u003c\u003d 100),表示数据组数\n对于每组数据:\n第一行是两个整数 n, m (1 \u003c\u003d n, m \u003c\u003d 10000),表示 tourist 的个数以及操作个数。\n接下来 m 行,每行一个操作,操作具体内容如上所述。"}},{"title":"Output","value":{"format":"MD","content":"每组数据前输出一个 \"Case XX:\" (参考样例)\n对于每个 Q A 型的操作,输出题目描述中的那 3 个整数。"}},{"title":"Sample","value":{"format":"MD","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\u003e\u003cpre\u003e2\n3 3\nT 1 2\nT 3 2\nQ 2\n3 4\nT 1 2\nQ 1\nT 1 3\nQ 1\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e\u003cpre\u003eCase 1:\n2 3 0\nCase 2:\n2 2 1\n3 3 2\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}