{"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\"\u003eIn Google, there are many experts of different areas. For example, MapReduce experts, Bigtable experts, SQL experts, etc. Directors need to properly assign experts to various projects in order to make the projects going smoothly.\u003cbr\u003eThere are N projects owned by a director. For the $i^{th}$ project, it needs $C_i$ different areas of experts, $a_{i,0}, a_{i,1}, · · · , a_{i,C_i-1}$ respective. There are M engineers reporting to the director. For the $i^{th}$ engineer, he is an expert of $D_i$ different areas, $b_{i,0}, b_{i,1}, ... , b_{i,D_i-1}.$\u003cbr\u003eEach engineer can only be assigned to one project and the director can assign several engineers to a project. A project can only be finished successfully if the engineers expert areas covers the project areas, which means, for each necessary area of the project, there is at least one engineer\u003cbr\u003emasters it.\u003cbr\u003eThe director wants to know how many projects can be successfully finished.\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input gives the number of test cases, T. T test cases follow. Each test case starts with a line consisting of 2 integers, N the number of projects and M the number of engineers. Then N lines follow. The $i^{th}$ line containing the information of the $i^{th}$ project starts\u003cbr\u003ewith an integer $C_i$ then $C_i$ integers follow, $a_{i,0}, a_{i,1}, ... , a_{i,C_i-1}$ representing the expert areas needed for the $i^{th}$ project. Then another M lines follow. The $i_{th}$ line containing the information of the $i^{th}$ engineer starts with an integer $D_i$ then $D_i$ integers follow, $b_{i,0}, b_{i,1}, ... , b_{i,D_i-1}$ representing the expert areas mastered by $i^{th}$ engineer.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each test case, output one line containing “Case #x: y”, where x is the test case number (starting from 1) and y is the maximum number of projects can be successfully finished.\u003cbr\u003e\u003ch2\u003elimits\u003c/h2\u003e\u003cbr\u003e$\\bullet 1 ≤ T ≤ 100.$\u003cbr\u003e$\\bullet 1 ≤ N, M ≤ 10.$\u003cbr\u003e$\\bullet 1 ≤ C_i ≤ 3.$\u003cbr\u003e$\\bullet 1 ≤ D_i ≤ 2.$\u003cbr\u003e$\\bullet 1 ≤ a_{i,j} , b_{i,j} ≤ 100.$\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\n3 4\r\n3 40 77 64\r\n3 10 40 20\r\n3 40 20 77\r\n2 40 77\r\n2 77 64\r\n2 40 10\r\n2 20 77\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: 2\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cbr\u003eFor the first test case, there are 3 projects and 4 engineers. One of the optimal solution is to assign the first(40 77) and second engineer(77 64) to project 1, which could cover the necessary areas 40, 77, 64. Assign the third(40 10) and forth(20 77) engineer to project 2, which could cover the necessary areas 10, 40, 20. There are other solutions, but none of them can finish all 3 projects.\u003cbr\u003eSo the answer is 2.\u003cbr\u003e"}}]}