{"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 There are so many submissions during this contest. Coach Pang can not determine which team is the winner. Could you help him to print the score board?\u003cbr\u003e As we all know, the contest executes by the teams submit codes for some problems. Simply, we assume there are three kinds of results for every submission.\u003cbr\u003e\u003cbr\u003e \u003cb\u003eERROR\u003c/b\u003e There was something wrong. The team didn’t solve the problem but won’t get any penalty.\u003cbr\u003e \u003cb\u003eNO\u003c/b\u003e Sorry, the code was not right. The team didn’t solve the problem.\u003cbr\u003e \u003cb\u003eYES\u003c/b\u003e Yeah, AC. The team solved the problem.\u003cbr\u003e\u003cbr\u003e To make the contest more exciting, we set a time called frozen time. If one team doesn’t solve one of the problems before the frozen time and submits at least one submission on this problem after or exactly at the frozen time, this problem of this team is called frozen. For different team, the frozen problems will be different. For the frozen problems, the score board will only show how many submissions the team has been submitted but won’t show the result of the submissions.\u003cbr\u003e The rank is determined by the following factors. Remember, we only consider the unfrozen problems. The frozen problems will be ignored. The following factors are ordered with the priority from high to low.\u003cbr\u003e\u003cbr\u003e \u003cb\u003eSolved\u003c/b\u003e the team who solves more problems will place higher.\u003cbr\u003e \u003cb\u003ePenalty\u003c/b\u003e the team who gets less penalty time will place higher. Only solved problems will give penalty time. Every solved problem will give T + 20X penalty time. T is the time of the first YES, X is the number of NOs before the first YES.\u003cbr\u003e \u003cb\u003eLast Solved\u003c/b\u003e the team who solved their last problem earlier will place higher. If there is a tie, we compare their second last problems, then their third last problems, etc.\u003cbr\u003e \u003cb\u003eName\u003c/b\u003e The team whose name comes later in lexicographical order will place higher.\u003cbr\u003e\u003cbr\u003e At the end of the contest, the score board will be unfrozen. First, choose the team which has frozen problems with the lowest rank. Then choose one frozen problem of this team. If the team has multiple frozen problems, choose their first frozen problem in alphabetic order. Then show the result of the problem, recalculate the rank, change the score board and make the problem unfrozen for this team. Repeat this procedure until no teams have frozen problems. Then we get the final score board.\u003cbr\u003e\u003cbr\u003e Please help Coach Pang to print the initial score board, the final score board and the process of the unfreeze procedure.\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":" The first line contains an integer C, which indicates the number of test cases.\u003cbr\u003e For each test case, the first line will have four integers n, m, T and t. n(1 \u0026lt;\u003d n \u0026lt;\u003d 50000) is the number of submissions. m(1 \u0026lt;\u003d m \u0026lt;\u003d 26) is the number of problems. T(1 \u0026lt;\u003d T \u0026lt;\u003d 10000) is the total time of the contest. t(0 \u0026lt;\u003d t \u0026lt;\u003d T) is the frozen time.\u003cbr\u003e\u003cbr\u003e The following n lines, each line will be in the form \"Name Problem Time Result\". Name is the team’s name which only contains letters and digits with at most 20 characters. Problem is the identifier of the problem which is a capital letter from A to them-th letter. Time is a integer indicates the submission time which greater than or equal to 0 and less than T. Result is one string which equal YES, NO or ERROR.\u003cbr\u003e Every team will have at least one submission. If one team has multiple submissions at the same time, we consider the ERRORs come before NOs and NOs come before YESs."}},{"title":"Output","value":{"format":"HTML","content":" For each test case, first print “Case #x:”, x is the case number start from 1.\u003cbr\u003e Then print the initial score board (before the unfreeze procedure) ordered by the rank. For every team, print \"Name Rank Solved Penalty A B C ...\". Name is the team’s name. Rank is the team’s rank. Solved is the number of solved problems. Penalty is the team’s penalty time.\u003cbr\u003eA B C ... is the condition of every problem is the format below:\u003cbr\u003e\u003cbr\u003e \u003cb\u003e+x\u003c/b\u003e The problem is unfrozen and solved. x is the number of NOs before the first YES. If x \u003d 0, print \"+\" instead of \"+0\".\u003cbr\u003e\u003cbr\u003e \u003cb\u003e-x\u003c/b\u003e The problem is unfrozen but not solved. x is the number of NOs. If x \u003d 0, print \".\" instead of \"-0\".\u003cbr\u003e\u003cbr\u003e \u003cb\u003e-x/y\u003c/b\u003e The problem is frozen. x is the number of NOs before the frozen time. y is the number of submissions aer or exact at the frozen time. If x \u003d 0, print \"0/y\" instead of \"-0/y\".\u003cbr\u003e\u003cbr\u003e After the initial score board, print the process of the unfreeze procedure. During the unfreeze procedure, every time one team unfreezes one frozen problem and causes the change of its rank, print \"Name1 Name2 Solved Penalty\". Suppose this team is team A. Name1 is the name of team A. Name2 is the name of the team which is overtaken by team A with the highest rank. Solved is the new number of the solved problems of team A. Penalty is the new penalty time of team A.\u003cbr\u003e Finally print the final score board (after the unfreeze procedure) as the same format as the initial score board.\u003cbr\u003e See the sample to get more details.\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\u003e1\r\n20 12 300 240\r\nEpic B 12 YES\r\nEpic A 14 NO\r\nRivercrab E 25 YES\r\nTwo2erII B 100 NO\r\nEpic A 120 YES\r\nRivercrab I 150 NO\r\nTwo2erII C 160 NO\r\nEpic C 180 YES\r\nTwo2erII C 180 NO\r\nRivercrab F 226 YES\r\nTwo2erII C 230 YES\r\nTwo2erII L 241 YES\r\nEpic F 246 YES\r\nEpic G 260 YES\r\nRivercrab I 289 YES\r\nEpic D 297 YES\r\nMusou H 299 YES\r\nMusou I 299 YES\r\nMusou J 299 YES\r\nMusou K 299 YES\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1:\r\nEpic 1 3 332 +1 + + 0/1 . 0/1 0/1 . . . . .\r\nRivercrab 2 2 251 . . . . + + . . -1/1 . . .\r\nTwo2erII 3 1 270 . -1 +2 . . . . . . . . 0/1\r\nMusou 4 0 0 . . . . . . . 0/1 0/1 0/1 0/1 .\r\nMusou Two2erII 2 598\r\nTwo2erII Musou 2 511\r\nMusou Rivercrab 3 897\r\nRivercrab Musou 3 560\r\nMusou Epic 4 1196\r\nEpic Musou 4 629\r\nEpic 1 6 1135 +1 + + + . + + . . . . .\r\nMusou 2 4 1196 . . . . . . . + + + + .\r\nRivercrab 3 3 560 . . . . + + . . +1 . . .\r\nTwo2erII 4 2 511 . -1 +2 . . . . . . . . +\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}