{"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":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e\n 随着新学期的到来,伊格内修斯火车站现在非常繁忙。\u003c/font\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e很多学生想坐火车回学校(因为伊格内修斯火车站的火车是世界上最快的^v^)。\u003c/font\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e但问题来了,所有火车都停在一条铁路上。\u003c/font\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e所以所有的火车都从一侧进来,从另一侧出来。\u003c/font\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e对于这个问题,如果火车A先进入铁路,然后火车B在火车A离开之前进入铁路,那么火车A不能离开直到火车B离开。\u003c/font\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e下面的图片可以解决问题。\u003c/font\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e现在你的问题是,车站最多有 9 辆火车,所有火车都有一个 ID(从 1 到 n 编号),火车按照 O1 的顺序进入铁路,你的任务是确定火车是否可以按O2的顺序出去。\u003c/font\u003e\u003c/font\u003e\u003cbr\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"https://vj.csgrandeur.cn/c450c75801b549e4d5206db51be5765d?v\u003d1660372057\" width\u003d\"184\" height\u003d\"188\"\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"https://vj.csgrandeur.cn/71568b28effab67b185f0b3d3e82fd79?v\u003d1660372057\" width\u003d\"184\" height\u003d\"188\"\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"https://vj.csgrandeur.cn/0a1ce595f0ba6f7b7025dc7a587d361f?v\u003d1660372057\" width\u003d\"184\" height\u003d\"188\"\u003e\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cfont style\u003d\"vertical-align: inherit;\"\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e输入包含几个测试用例。\u003c/font\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e每个测试用例由一个整数、火车的数量和两个字符串组成,火车进来的顺序:O1,火车离开的顺序:O2。\u003c/font\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e输入在文件末尾终止。\u003c/font\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e示例输入中的更多详细信息。\u003c/font\u003e\u003c/font\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cfont style\u003d\"vertical-align: inherit;\"\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e输出包含一个字符串“No”。\u003c/font\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e如果你不能将O2换成O1,或者你应该输出一行包含“Yes.”,然后输出你的交换顺序的方式(你应该输出“in”代表火车进入铁路,“out”火车驶出铁路)。\u003c/font\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e在每个测试用例之后打印一行包含“FINISH”。\u003c/font\u003e\u003cfont style\u003d\"vertical-align: inherit;\"\u003e示例输出中的更多详细信息。\u003c/font\u003e\u003c/font\u003e"}},{"title":"Sample","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\u003e\u003cpre\u003e3 123 321\n3 123 312\n\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e\u003cpre\u003eYes.\nin\nin\nin\nout\nout\nout\nFINISH\nNo.\nFINISH\n对于第一个样本输入,我们让训练 1 进入,然后训练 2 和训练 3。 所以现在3号列车在铁路的顶部,所以3号列车可以先离开,然后2号列车和1号列车。 在第二个 Sample 输入中,我们应该让 train 3 先离开,所以我们必须让 train 1 进来,然后 train 2 和 train 3。 现在我们可以让火车 3 离开。 但是在那之后我们不能让火车1在火车2之前离开,因为火车2现在在铁路的顶部。 所以我们输出“No.”。\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"Hint"}}]}