{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":" \n \u003cp\u003eChinese checkers is a strategy board game, which can be played by two, three, four, or six people, playing individually or with partners.\u003c/p\u003e \n \u003cp\u003e\u003cimg src\u003d\"CDN_BASE_URL/0dc1768bfc25ea24528ccced4bd24499?v\u003d1659140806\" title\u003d\"d.png\" width\u003d\"464\" height\u003d\"390\" border\u003d\"0\" hspace\u003d\"0\" vspace\u003d\"0\" style\u003d\"width:464px;height:390px;float:none;\"\u003e\u003cbr\u003e\u003c/p\u003e \n \u003cp\u003eSix players are playing a new version of Chinese checkers, whose rules are different from the traditional ones.\u003c/p\u003e \n \u003cp\u003e1. The figure shows the shape of the board and the corner belonging to each player. A circle in the figure represents a space. Obviously, the board has 17 rows, and different rows may have different number of spaces. The corner belonging to each player consists of 10 spaces.\u003c/p\u003e \n \u003cp\u003e2. Each player has 10 pieces. At the beginning of the game, each player puts all his/her pieces on his/her corner and each piece occupies a space.\u003c/p\u003e \n \u003cp\u003e3. Players take turns moving a single piece, either by moving one step to an adjacent empty space, or by jumping over a symmetrical pattern (which includes at least one piece) to an empty space in one of six directions (left, right, upper left, upper right, lower left, lower right).\u003c/p\u003e \n \u003cp\u003eFor example, when E is an empty space, a piece can jump from A to E if and only if:\u003c/p\u003e \n \u003cp\u003e1) there is a piece at C while B and D are empty spaces,\u003c/p\u003e \n \u003cp\u003e2) or there are two pieces at B and D while C is an empty space,\u003c/p\u003e \n \u003cp\u003e3) or there are three pieces at B, C and D. \u003c/p\u003e \n \u003cp\u003eWhen D is an empty space, a piece can jump from A to D if and only if there are two pieces at B and C. \u003c/p\u003e \n \u003cp\u003e4. Player 1 take action first, and then Player 2, and so on.\u003c/p\u003e \n \u003cp\u003e5. A player can never move his pieces into others’ corner except the corner opposite to his corner. For example, Player 6 can move his pieces into his own corner or Player 5’s corner.\u003c/p\u003e \n \u003cp\u003eWhen the six players take their turns, they choose a piece and a direction, and then they always move the piece to the farthest possible space. Given the pieces and the directions that they choose during the first N turns, can you tell where their pieces located?\u003c/p\u003e \n "}},{"title":"Input","value":{"format":"HTML","content":" \n \u003cp\u003eThe input consists of multiple test cases. (Up to 1000)\u003c/p\u003e \n \u003cp\u003eFor each test case:\u003c/p\u003e \n \u003cp\u003eThe first line contains an integer N, indicating the number of turns. (1≤∑N≤10\u003csup\u003e5\u003c/sup\u003e)\u003c/p\u003e \n \u003cp\u003eThen N lines follow, each line contains two integers x,y and a direction, separated by white spaces. These indicate that a player choose the piece located at the y\u003csup\u003eth\u003c/sup\u003e space of the x\u003csup\u003eth\u003c/sup\u003e row, and moves it in that direction.\u003c/p\u003e \n \u003cp\u003eFor simplicity, the directions are given in form of abbreviations. \u003cstrong\u003eL\u003c/strong\u003e represents left. \u003cstrong\u003eR\u003c/strong\u003e represents right. \u003cstrong\u003eUL\u003c/strong\u003e represents upper left. \u003cstrong\u003eUR\u003c/strong\u003e represents upper right. \u003cstrong\u003eLL\u003c/strong\u003e represents lower left. \u003cstrong\u003eLR\u003c/strong\u003e represents lower right.\u003c/p\u003e \n \u003cp\u003eIf the player does not have a piece located at the y\u003csup\u003eth\u003c/sup\u003e space of the x\u003csup\u003eth\u003c/sup\u003e row, or the piece can never move in the given direction, please skip his/her turn (This player do nothing in his turn). It is guaranteed that the given position and direction are valid.\u003c/p\u003e \n "}},{"title":"Output","value":{"format":"HTML","content":" \n \u003cp\u003e\u003cspan\u003eFor each test case, output six lines. The i\u003c/span\u003e\u003csup\u003eth\u003c/sup\u003e\u003cspan\u003e line contains twenty integers x\u003c/span\u003e\u003csub\u003e1\u003c/sub\u003e\u003cspan\u003e,y\u003c/span\u003e\u003csub\u003e1\u003c/sub\u003e\u003cspan\u003e,x\u003c/span\u003e\u003csub\u003e2\u003c/sub\u003e\u003cspan\u003e,y\u003c/span\u003e\u003csub\u003e2\u003c/sub\u003e\u003cspan\u003e,…,x\u003c/span\u003e\u003csub\u003e10\u003c/sub\u003e\u003cspan\u003e,y\u003c/span\u003e\u003csub\u003e10\u003c/sub\u003e\u003cspan\u003e separated by white spaces, indicating the position of the Player i’s pieces. The j\u003c/span\u003e\u003csup\u003eth\u003c/sup\u003e\u003cspan\u003e piece located at the y\u003c/span\u003e\u003csub\u003ej\u003c/sub\u003e\u003csup\u003eth\u003c/sup\u003e\u003cspan\u003e space of the x\u003c/span\u003e\u003csub\u003ej\u003c/sub\u003e\u003csup\u003eth\u003c/sup\u003e\u003cspan\u003e row. The positions should be sorted by x first and then by y in ascending order.\u003c/span\u003e\u003c/p\u003e \n \u003c/div\u003e \n "}},{"title":"Sample Input","value":{"format":"HTML","content":" \n \u003cpre\u003e12\r\n1 1 LL\r\n16 1 UL\r\n10 1 R\r\n5 11 L\r\n11 10 L\r\n7 1 LR\r\n2 2 LR\r\n13 5 UL\r\n12 2 R\r\n5 12 L\r\n11 11 L\r\n6 1 LR\u003c/pre\u003e \n "}},{"title":"Sample Output","value":{"format":"HTML","content":" \n \u003cpre\u003e2 1 3 1 3 2 3 3 4 1 4 2 4 3 4 4 5 5 6 9\r\n12 4 14 1 14 2 14 3 14 4 15 1 15 2 15 3 16 2 17 1\r\n10 2 11 1 11 2 12 1 12 3 12 5 13 1 13 2 13 3 13 4\r\n5 7 5 9 5 10 5 13 6 10 6 11 6 12 7 10 7 11 8 10\r\n10 10 11 7 11 9 12 10 12 11 12 12 13 10 13 11 13 12 13 13\r\n5 1 5 2 5 3 5 4 6 2 6 3 7 1 7 2 8 1 11 3\u003c/pre\u003e \n "}}]}