{"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\"\u003eTopSetter is an organization that creates problems. They’ve prepared N problems with estimated difficulty score in range [ $A_i , B_i$ ]. TopHoster would like to host a contest consisting of M problems.\u003cbr\u003eThe $i^{th}$ problem should be of difficulty score $C_i$. The $i^{th}$ problem from TopSetter can be used in the contest if and only if its estimated difficulty score range $[A_i, B_i]$ covers the difficulty score c of its target problem in the contest, i.e. $A_i ≤ c ≤ B_i$ . Hosting a contest with M problems needs tohave M distinct problems which satisfy the required difficulty scores for each problem.\u003cbr\u003eUnfortunately, TopSetter doesn’t provide a service to buy specific problems. You can only request a problem set containing K problems and they will give you K distinct problems from all the N problems, but you don’t know which problems will be given.\u003cbr\u003eAs TopSetter is the only problem provider for TopHoster, TopHoster would like to know the least number K of problems they need to buy to make sure they can host a contest.\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 2 integers, N and M. Then N lines follow, each line consists of 2 integers representing the difficulty score range of the $i^{th}$ problem, $A_i and B_i$ . The last line of each test case consists of M integers representing the target difficulty scores of the M problems $C_i$ .\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 least number of problems which the TopHoster needs to buy.\u003cbr\u003eOutput “IMPOSSIBLE!” if it’s impossible.\u003cbr\u003e\u003ch2\u003elimits\u003c/h2\u003e\u003cbr\u003e$\\bullet 1 ≤ T ≤ 100.$\u003cbr\u003e$\\bullet 1 ≤ N, M ≤ 10^5.$\u003cbr\u003e$\\bullet 1 ≤ A_i ≤ B_i ≤ 10^9.$\u003cbr\u003e$\\bullet 1 ≤ C_i ≤ 10^9.$"}},{"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\u003e3\r\n3 1\r\n1 4\r\n2 3\r\n5 6\r\n3\r\n3 2\r\n1 10\r\n3 4\r\n7 9\r\n4 8\r\n3 3\r\n1 2\r\n5 6\r\n8 9\r\n1 5 10\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: 2\r\nCase #2: 2\r\nCase #3: IMPOSSIBLE!\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}