{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003e\u003cvar\u003e\\(2N\\)\u003c/var\u003e players, with ID numbers \u003cvar\u003e\\(1\\)\u003c/var\u003e through \u003cvar\u003e\\(2N\\)\u003c/var\u003e, will participate in a rock-scissors-paper contest.\u003c/p\u003e\r\n\u003cp\u003eThe contest has \u003cvar\u003e\\(M\\)\u003c/var\u003e rounds. Each round has \u003cvar\u003e\\(N\\)\u003c/var\u003e one-on-one matches, where each player plays in one of them.\u003c/p\u003e\r\n\u003cp\u003eFor each \u003cvar\u003e\\(i\u003d0, 1, \\ldots, M\\)\u003c/var\u003e, the players\u0027 ranks at the end of the \u003cvar\u003e\\(i\\)\u003c/var\u003e-th round are determined as follows.\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eA player with more wins in the first \u003cvar\u003e\\(i\\)\u003c/var\u003e rounds ranks higher.\u003c/li\u003e\r\n\u003cli\u003eTies are broken by ID numbers: a player with a smaller ID number ranks higher.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eAdditionally, for each \u003cvar\u003e\\(i\u003d1, \\ldots, M\\)\u003c/var\u003e, the matches in the \u003cvar\u003e\\(i\\)\u003c/var\u003e-th round are arranged as follows.\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eFor each \u003cvar\u003e\\(k\u003d1, 2, \\ldots, N\\)\u003c/var\u003e, a match is played between the players who rank \u003cvar\u003e\\((2k-1)\\)\u003c/var\u003e-th and \u003cvar\u003e\\(2k\\)\u003c/var\u003e-th at the end of the \u003cvar\u003e\\((i-1)\\)\u003c/var\u003e-th round.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eIn each match, the two players play a hand just once, resulting in one player\u0027s win and the other\u0027s loss, or a draw.\u003c/p\u003e\r\n\u003cp\u003eTakahashi, who can foresee the future, knows that Player \u003cvar\u003e\\(i\\)\u003c/var\u003e will play \u003cvar\u003e\\(A_{i, j}\\)\u003c/var\u003e in their match in the \u003cvar\u003e\\(j\\)\u003c/var\u003e-th round, where \u003cvar\u003e\\(A_{i,j}\\)\u003c/var\u003e is \u003ccode\u003eG\u003c/code\u003e, \u003ccode\u003eC\u003c/code\u003e, or \u003ccode\u003eP\u003c/code\u003e.\u003cbr\u003e\r\nHere, \u003ccode\u003eG\u003c/code\u003e stands for rock, \u003ccode\u003eC\u003c/code\u003e stands for scissors, and \u003ccode\u003eP\u003c/code\u003e stands for paper. \u003cem\u003e(These derive from Japanese.)\u003c/em\u003e\u003c/p\u003e\r\n\u003cp\u003eFind the players\u0027 ranks at the end of the \u003cvar\u003e\\(M\\)\u003c/var\u003e-th round.\u003c/p\u003e\r\n\u003cdetails\u003e\u003csummary\u003eRules of rock-scissors-paper\u003c/summary\u003e\r\nThe result of a rock-scissors-paper match is determined as follows, based on the hands played by the two players.\r\n\u003cul\u003e\r\n\u003cli\u003e If one player plays rock (G) and the other plays scissors (C), the player playing rock (G) wins.\u003c/li\u003e\r\n\u003cli\u003e If one player plays scissors (C) and the other plays paper (P), the player playing scissors (C) wins.\u003c/li\u003e\r\n\u003cli\u003e If one player plays paper (P) and the other plays rock (G), the player playing paper (P) wins.\u003c/li\u003e\r\n\u003cli\u003e If the players play the same hand, the match is drawn.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/details\u003e\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Constraints","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq N \\leq 50\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq M \\leq 100\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(A_{i,j}\\)\u003c/var\u003e is \u003ccode\u003eG\u003c/code\u003e, \u003ccode\u003eC\u003c/code\u003e, or \u003ccode\u003eP\u003c/code\u003e.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Input","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e \u003cvar\u003e\\(M\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(A_{1,1}A_{1,2}\\ldots A_{1,M}\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(A_{2,1}A_{2,2}\\ldots A_{2,M}\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(\\vdots\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(A_{2N,1}A_{2N,2}\\ldots A_{2N,M}\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Output","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003ePrint \u003cvar\u003e\\(2N\\)\u003c/var\u003e lines.\u003c/p\u003e\r\n\u003cp\u003eThe \u003cvar\u003e\\(i\\)\u003c/var\u003e-th line should contain the ID number of the player who ranks \u003cvar\u003e\\(i\\)\u003c/var\u003e-th at the end of the \u003cvar\u003e\\(M\\)\u003c/var\u003e-th round.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 1","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\u003e2 3\r\nGCP\r\nPPP\r\nCCC\r\nPPC\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\r\n1\r\n2\r\n4\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\u003cp\u003eIn the first round, matches are played between Players \u003cvar\u003e\\(1\\)\u003c/var\u003e and \u003cvar\u003e\\(2\\)\u003c/var\u003e, and between Players \u003cvar\u003e\\(3\\)\u003c/var\u003e and \u003cvar\u003e\\(4\\)\u003c/var\u003e. Player \u003cvar\u003e\\(2\\)\u003c/var\u003e wins the former, and Player \u003cvar\u003e\\(3\\)\u003c/var\u003e wins the latter.\u003cbr\u003e\r\nIn the second round, matches are played between Players \u003cvar\u003e\\(2\\)\u003c/var\u003e and \u003cvar\u003e\\(3\\)\u003c/var\u003e, and between Players \u003cvar\u003e\\(1\\)\u003c/var\u003e and \u003cvar\u003e\\(4\\)\u003c/var\u003e. Player \u003cvar\u003e\\(3\\)\u003c/var\u003e wins the former, and Player \u003cvar\u003e\\(1\\)\u003c/var\u003e wins the latter.\u003cbr\u003e\r\nIn the third round, matches are played between Players \u003cvar\u003e\\(3\\)\u003c/var\u003e and \u003cvar\u003e\\(1\\)\u003c/var\u003e, and between Players \u003cvar\u003e\\(2\\)\u003c/var\u003e and \u003cvar\u003e\\(4\\)\u003c/var\u003e. Player \u003cvar\u003e\\(3\\)\u003c/var\u003e wins the former, and Player \u003cvar\u003e\\(4\\)\u003c/var\u003e wins the latter.\u003cbr\u003e\r\nTherefore, in the end, the players are ranked in the following order: \u003cvar\u003e\\(3,1,2,4\\)\u003c/var\u003e, from highest to lowest.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 2","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\u003e2 2\r\nGC\r\nPG\r\nCG\r\nPP\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n2\r\n3\r\n4\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\u003cp\u003eIn the first round, matches are played between Players \u003cvar\u003e\\(1\\)\u003c/var\u003e and \u003cvar\u003e\\(2\\)\u003c/var\u003e, and between Players \u003cvar\u003e\\(3\\)\u003c/var\u003e and \u003cvar\u003e\\(4\\)\u003c/var\u003e. Player \u003cvar\u003e\\(2\\)\u003c/var\u003e wins the former, and Player \u003cvar\u003e\\(3\\)\u003c/var\u003e wins the latter.\u003cbr\u003e\r\nIn the second round, matches are played between Players \u003cvar\u003e\\(2\\)\u003c/var\u003e and \u003cvar\u003e\\(3\\)\u003c/var\u003e, and between Players \u003cvar\u003e\\(1\\)\u003c/var\u003e and \u003cvar\u003e\\(4\\)\u003c/var\u003e. The former is drawn, and Player \u003cvar\u003e\\(1\\)\u003c/var\u003e wins the latter.\u003cbr\u003e\r\nTherefore, in the end, the players are ranked in the following order: \u003cvar\u003e\\(1,2,3,4\\)\u003c/var\u003e, from highest to lowest.\u003c/p\u003e\u003c/section\u003e\r\n"}}]}