{"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\"\u003eFling is a kind of puzzle games available on phone.\u003cbr\u003eThis game is played on a board with 7 rows and 8 columns. Each puzzle consists of a set of furballs placed on the board. To solved a puzzle, you need to remove the furballs from board until there is no more than one furball on the board. You do this by \u0026amp;#180;flinging\u0026amp;#180; furballs into other furballs, to knock them off the board. You can fling any furballs in four directions (up, left, right, down). The flung furball stops at the front grid of another one as soon as knocking it. And the knocked furball continues to rolling in the same direction until the last knocked one goes off the board. For instance, A furball at (0, 0) rolls right to the furball at (0, 5), then it will stop at (0, 4). Moreover, the latter will roll to right. You cannot fling a furball into a neighbouring furball, the one next to in any of four directions. However, it is permitted for a rolling ball knocks into a ball with a neighbour in that direction.\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/25399921c94d2c9f0cdd38f016f3eb8b?v\u003d1714733119\"\u003e\u003c/center\u003e \u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input contains multiple test cases.\u003cbr\u003eFor each case, the 7 lines with 8 characters describe the board. \u0026amp;#180;X\u0026amp;#180; represents a empty grid and \u0026amp;#180;O\u0026amp;#180; represents a grid with a furball in it. There are no more than 12 furballs in any board.\u003cbr\u003eEach case separated by a blank line.\u003cbr\u003e\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each case, print a line formatted as \"CASE #NUM:\", where NUM is the number of current case.\u003cbr\u003eThen every \u0026amp;#180;fling\u0026amp;#180; prints a line. Each line contains two integers X, Y and a character Z. The flung furball is located at grid (X, Y), the top-left grid is (0, 0). And Z represents the direction this furball towards: U (Up), L (Left), R (Right) and D (Down);\u003cbr\u003ePrint a blank line between two cases.\u003cbr\u003eYou can assume that every puzzle could be solved.\u003cbr\u003eIf there are multiple solve sequences, print the smallest one. That is, Two sequences A (A1, A2, A3 ... An) and B (B1, B2, B3 ... Bn). Let k be the smallest number that Ak !\u003d Bk.\u003cbr\u003eDefine A \u0026lt; B :\u003cbr\u003e(1) X in Ak \u0026lt; X in Bk;\u003cbr\u003e(2) Y in Ak \u0026lt; Y in Bk and X in Ak \u003d X in Bk;\u003cbr\u003e(3) Z in Ak \u0026lt; Z in Bk and (X,Y) in Ak \u003d (X,Y) in Bk;\u003cbr\u003eThe order of Z: U \u0026lt; L \u0026lt; R \u0026lt; D.\u003cbr\u003e\u003cbr\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\u003eXXXXXXXX\r\nXXOXXXXX\r\nXXXXXXXX\r\nXXXXXXXX\r\nXOXXXXOX\r\nXXXXXXXX\r\nXXXXXXXX\r\n\r\nXXXXXXXX\r\nXOXOXOOX\r\nXXXXXXXX\r\nXXXXXXXX\r\nXXXXXXXX\r\nXXXXXXXX\r\nXXXXXXXX\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCASE #1:\r\n4 6 L\r\n1 2 D\r\n\r\nCASE #2:\r\n1 1 R\r\n1 4 L\r\n1 3 R\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}