{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cstyle type\u003d\"text/css\"\u003e pre { text-align:left; font-family: \"Courier New\", Courier, monospace; font-size: 16px; white-space: pre; line-height:20px; text-indent: 0px; }\u003c/style\u003e\u003cdiv class\u003d\"pro_desc\"\u003e\n \u003cp\u003eXzz is playing a MMORPG \"human life\". \u003c/p\u003e\n \u003cp\u003eIn this game, there are N different skills. Some skills may base on another skill. \u003c/p\u003e\n \u003cp\u003eLearning skill will cost Xzz some money. \u003c/p\u003e\n \u003cp\u003eAnd there are M different jobs. If Xzz\u0027s skills satisfy the job\u0027s requirement, then Xzz can get this job, and get some money. \u003c/p\u003e\n \u003cp\u003eBut some jobs are conflict, some Xzz can\u0027t get the job at same time. \u003c/p\u003e\n \u003cp\u003eThere are K pairs of jobs are conflict. \u003c/p\u003e\n \u003cp\u003eNow Xzz want to know the money he can get at the most,can you help him. \u003c/p\u003e\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"pro_desc\"\u003e\n \u003cp\u003eFirst line of the input file contains an integer T(0 \u0026lt; T ≤ 10) that indicates how many cases of inputs are there. \u003c/p\u003e\n \u003cp\u003eThe description of each case is given below: \u003c/p\u003e\n \u003cp\u003eThe first line of each input case contains number N, M, K. N \u0026lt;\u003d 100, M \u0026lt;\u003d 50, K \u0026lt;\u003d 5. \u003c/p\u003e\n \u003cp\u003eThen follow N lines. In ith line the first two number ? ,? , means learning skill i const vi , skill i base on another ni skills. The last ni number aij means before learning skill i Xzz need to learn skill aij. 0 ≤ vi ≤ 1000, 0 ≤ ni ≤ N \u003c/p\u003e\n \u003cp\u003eThen follow M lines. In ith line the first two number wi, mi , means job i earn wi, jobs i base on mi skills. The last mi number bij means get job i need to learn skill bij. 0 ≤ wi ≤ 1000, 0 ≤ mi ≤ M \u003c/p\u003e\n \u003cp\u003eThen follow K lines. In ith line the first two number ci, di, means job ci conflict with job di.\u003c/p\u003e\n\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"pro_desc\"\u003e\n \u003cp\u003eThe description of output for each test case is given below: \u003c/p\u003e\n \u003cp\u003eThe first line of the output for each test case contains number answer, the maximum money Xzz can get. \u003c/p\u003e\n\u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e2\r\n5 2 0\r\n1 0\r\n1 1 1\r\n1 0\r\n1 0\r\n1 1 4\r\n10 2 2 3\r\n8 2 3 5\r\n5 2 1\r\n1 0\r\n1 1 1\r\n1 0\r\n1 0\r\n1 1 4\r\n10 2 2 3\r\n8 2 3 5\r\n1 2\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e13\r\n7\u003c/pre\u003e"}}]}