{"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\u003eThere is a field divided into $$$n$$$ rows and $$$m$$$ columns. Some cells are empty (denoted as \u003cspan class\u003d\"tex-font-style-tt\"\u003eE\u003c/span\u003e), other cells contain robots (denoted as \u003cspan class\u003d\"tex-font-style-tt\"\u003eR\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eYou can send a command to \u003cspan class\u003d\"tex-font-style-bf\"\u003eall robots\u003c/span\u003e at the same time. The command can be of one of the four types:\u003c/p\u003e\u003cul\u003e \u003cli\u003e move up; \u003c/li\u003e\u003cli\u003e move right; \u003c/li\u003e\u003cli\u003e move down; \u003c/li\u003e\u003cli\u003e move left. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eWhen you send a command, \u003cspan class\u003d\"tex-font-style-bf\"\u003eall robots at the same time\u003c/span\u003e attempt to take one step in the direction you picked. If a robot tries to move outside the field, it explodes; otherwise, \u003cspan class\u003d\"tex-font-style-bf\"\u003eevery robot\u003c/span\u003e moves to an adjacent cell in the chosen direction.\u003c/p\u003e\u003cp\u003eYou can send as many commands as you want (possibly, zero), in any order. Your goal is to make at least one robot reach the upper left corner of the field. Can you do this without forcing any of the robots to explode?\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains one integer $$$t$$$ ($$$1 \\le t \\le 5000$$$)\u0026nbsp;— the number of test cases.\u003c/p\u003e\u003cp\u003eEach test case starts with a line containing two integers $$$n$$$ and $$$m$$$ ($$$1 \\le n, m \\le 5$$$)\u0026nbsp;— the number of rows and the number of columns, respectively. Then $$$n$$$ lines follow; each of them contains a string of $$$m$$$ characters. Each character is either \u003cspan class\u003d\"tex-font-style-tt\"\u003eE\u003c/span\u003e (empty cell} or \u003cspan class\u003d\"tex-font-style-tt\"\u003eR\u003c/span\u003e (robot).\u003c/p\u003e\u003cp\u003eAdditional constraint on the input: in each test case, there is at least one robot on the field.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eIf it is possible to make at least one robot reach the upper left corner of the field so that no robot explodes, print \u003cspan class\u003d\"tex-font-style-tt\"\u003eYES\u003c/span\u003e. Otherwise, print \u003cspan class\u003d\"tex-font-style-tt\"\u003eNO\u003c/span\u003e.\u003c/p\u003e"}},{"title":"Examples","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\u003e6\n1 3\nERR\n2 2\nER\nRE\n2 2\nER\nER\n1 1\nR\n4 3\nEEE\nEEE\nERR\nEER\n3 3\nEEE\nEER\nREE\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\nNO\nYES\nYES\nYES\nNO\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eExplanations for test cases of the example:\u003c/p\u003e\u003col\u003e \u003cli\u003e in the first test case, it is enough to send a command to move left. \u003c/li\u003e\u003cli\u003e in the second test case, if you try to send any command, at least one robot explodes. \u003c/li\u003e\u003cli\u003e in the third test case, it is enough to send a command to move left. \u003c/li\u003e\u003cli\u003e in the fourth test case, there is already a robot in the upper left corner. \u003c/li\u003e\u003cli\u003e in the fifth test case, the sequence \"move up, move left, move up\" leads one robot to the upper left corner; \u003c/li\u003e\u003cli\u003e in the sixth test case, if you try to move any robot to the upper left corner, at least one other robot explodes. \u003c/li\u003e\u003c/ol\u003e"}}]}