{"trustable":false,"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":"MD","content":"Today, XXacm Lab had another trial, but it was not smooth after the competition.\n\nThe competition system is the ICPC competition system, and the ranking above is only based on the number of Accepted questions. Each question has no score.However when dzy exported the ranklist, the ranking order was out of order! In order to better reflect the level of each team member, the score of each question and the score line of outstanding team members are given. Please find out the outstanding team members and print their scores in descending order. If the scores of the two teams are the same, they should be sorted in ascending order according to the test number."}},{"title":"Input","value":{"format":"MD","content":"The test input contains information about several exams.For each examination information:\n\nThe first line gives the number of candidates $N (0 \\leq N \\leq 1000)$, the number of questions $M (1 \\leq M \\leq 10)$, and the score line (positive integer) $G$\n\nThe second line gives the positive integer score of questions 1 to M;\n\nIn the following N lines, each line gives an test number $s(|s|\\leq20)$, $K$ —the total number of problem solved by the candidate, and then there will be K integers represent the index of the $K$ questions (from $1$ to $M$).\n\nWhen the number of candidates read in is $0$, the entry is completed and the exam will not be processed."}},{"title":"Output","value":{"format":"MD","content":"For each examination:\nThe first line output the number $n$ of candidates who are not lower than the score line \nIn the following $n$ lines, output the test number and score of candidates from high to low in line n, separated by a space. If the scores of the two teams are the same, they should be sorted in ascending order according to the test number."}},{"title":"Sample","value":{"format":"MD","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\u003e\u003cpre\u003e4 5 25\n10 10 12 13 15\nCS004 3 5 1 3\nCS003 5 2 4 1 3 5\nCS002 2 1 2\nCS001 3 2 3 5\n1 2 40\n10 30\nCS001 1 2\n2 3 20\n10 10 10\nCS000000000000000001 0\nCS000000000000000002 2 1 2\n0\n\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e\u003cpre\u003e3\nCS003 60\nCS001 37\nCS004 37\n0\n1\nCS000000000000000002 20\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}