{"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":"\n\u003cdiv class\u003d\"panel_content\"\u003e\n随着新学期的到来,伊格纳修斯火车站现在非常繁忙。许多学生想要乘坐火车返回学校(因为伊格纳修斯火车站的火车是全世界最快的 ^v^)。但是问题来了,只有一条铁路可以让所有火车停靠。因此,所有火车都从一侧进入,从另一侧出去。对于这个问题,如果火车A先进入铁路,然后火车B在火车A离开之前进入铁路,那么火车A就不能离开,直到火车B离开。下面的图片解决了这个问题。现在你的问题是,车站最多有9辆火车,所有火车都有一个编号(从1到n),火车按照顺序O1进入铁路,你的任务是确定火车是否可以按照顺序O2离开。\n\u003cbr\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/c450c75801b549e4d5206db51be5765d?v\u003d1698658376\"\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/71568b28effab67b185f0b3d3e82fd79?v\u003d1698658376\"\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/0a1ce595f0ba6f7b7025dc7a587d361f?v\u003d1698658376\"\u003e\n\u003c/div\u003e\n"}},{"title":"输入格式","value":{"format":"HTML","content":"输入包含多个测试用例。每个测试用例包含一个整数,表示火车数量,以及两个字符串,表示火车进入的顺序O1和火车离开的顺序O2。输入以文件结尾。更多细节请参见样例输入。\n\u003cbr\u003e"}},{"title":"输出格式","value":{"format":"HTML","content":"如果你不能将O2交换到O1,则输出字符串“No.”。否则,应该输出一行包含“Yes.”的字符串,然后输出你交换顺序的方式(对于进入铁路的火车,应该输出“in”,对于离开铁路的火车,应该输出“out”)。在每个测试用例后打印一行包含“FINISH”的字符串。更多细节请参见样例输出。\n\u003cbr\u003e"}},{"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\u003e3 123 321\r\n3 123 312\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYes.\r\nin\r\nin\r\nin\r\nout\r\nout\r\nout\r\nFINISH\r\nNo.\r\nFINISH\r\nFor the first Sample Input, we let train 1 get in, then train 2 and train 3.\r\nSo now train 3 is at the top of the railway, so train 3 can leave first, then train 2 and train 1.\r\nIn the second Sample input, we should let train 3 leave first, so we have to let train 1 get in, then train 2 and train 3.\r\nNow we can let train 3 leave.\r\nBut after that we can\u0027t let train 1 leave before train 2, because train 2 is at the top of the railway at the moment.\r\nSo we output \"No.\".\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"提示","value":{"format":"HTML","content":"提示"}}]}