{"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\"\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/937b6b38e359d21cfdc3bdfe8caa48ae?v\u003d1726319835\"\u003e\u003c/center\u003e \u003cbr\u003eXiangqi is one of the most popular two-player board games in China. The game represents a battle between two armies with the goal of capturing the enemy’s “general” piece.\u003cbr\u003eNow we introduce some basic rules of Xiangqi. Xiangqi is played on a 10×9 board and the pieces are placed on the intersections (points). There are two groups of pieces marked by black or red Chinese characters, belonging to the two players separately. During the game, each player in turn moves one piece from the point it occupies to another point. No two pieces can occupy the same point at the same time. A piece can be moved onto a point occupied by an enemy piece, in which case the enemy piece is \"captured\" and removed from the board. When the general is in danger of being captured by the enemy player on the enemy player’s next move, the enemy player is said to have \"delivered a check\". If the general\u0027s player can make no move to prevent the general\u0027s capture by next enemy move, the situation is called “checkmate”. \u003cbr\u003eEach player has 7 kinds of pieces in this game. Their names, offense power and symbol letters are shown in the table below:\u003cbr\u003e\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/a833f10cd8750241c06c4298aab83025?v\u003d1726319835\"\u003e\u003c/center\u003e \u003cbr\u003e\u003cbr\u003eNow show you the pieces of red player and black player, you are going to find out which player has the larger total offense power. Since Ma and Pao working together can have good effect, if a player has no Ma or no Pao, or has neither, his total offense power will be decreased by one. But the total offense power can\u0027t be decreased to zero, it is at least one.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line is an integer T ( T \u0026lt;\u003d 20) meaning there are T test cases. \u003cbr\u003eFor each test case: The first line shows which pieces the red player has. It begins with an integer n ( 0 \u0026lt; n \u0026lt;\u003d 16) meaning the number of pieces. \u003cbr\u003eThen n letters follows, all separated by one or more blanks. Each letter is a symbol letter standing for a piece, as shown in the table above. \u003cbr\u003eThe second line describes the situation of the black player, in the same format as the first line."}},{"title":"Output","value":{"format":"HTML","content":"For each test case, if the red player has more offense power, then print \"red\". If the black player has more offense power, then print \"black\". If there is a tie, print \"tie\"."}},{"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\u003e3\r\n2 A B\r\n2 A B\r\n7 A A B C D D F \r\n7 A A B B C C F\r\n5 A A B B F\r\n3 A B F\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003etie\r\nblack\r\nred\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}