{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\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 type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eOnce upon a time Algoland and Berland were a single country, but those times are long gone. Now they are two different countries, but their cities are scattered on a common territory.\u003c/p\u003e\u003cp\u003eAll cities are represented as points on the Cartesian plane. Algoland consists of $$$a$$$ cities numbered from $$$1$$$ to $$$a$$$. The coordinates of the $$$i$$$-th Algoland city are a pair of integer numbers $$$(xa_i, ya_i)$$$. Similarly, Berland consists of $$$b$$$ cities numbered from $$$1$$$ to $$$b$$$. The coordinates of the $$$j$$$-th Berland city are a pair of integer numbers $$$(xb_j, yb_j)$$$. \u003cspan class\u003d\"tex-font-style-it\"\u003eNo three of the $$$a+b$$$ mentioned cities lie on a single straight line\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eAs the first step to unite the countries, Berland decided to build several bidirectional freeways. Each freeway is going to be a line segment that starts in a Berland city and ends in an Algoland city. Freeways can\u0027t intersect with each other at any point except freeway\u0027s start or end. Moreover, the freeways have to connect all $$$a+b$$$ cities. Here, connectivity means that one can get from any of the specified $$$a+b$$$ cities to any other of the $$$a+b$$$ cities using freeways. Note that all freeways are bidirectional, which means that one can drive on each of them in both directions.\u003c/p\u003e\u003cp\u003eMayor of each of the $$$b$$$ Berland cities allocated a budget to build the freeways that start from this city. Thus, you are given the numbers $$$r_1, r_2, \\dots, r_b$$$, where $$$r_j$$$ is the number of freeways that are going to start in the $$$j$$$-th Berland city. The total allocated budget is very tight and only covers building the minimal necessary set of freeways. In other words, $$$r_1+r_2+\\dots+r_b\u003da+b-1$$$.\u003c/p\u003e\u003cp\u003eHelp Berland to build the freeways so that:\u003c/p\u003e\u003cul\u003e \u003cli\u003e each freeway is a line segment connecting a Berland city and an Algoland city, \u003c/li\u003e\u003cli\u003e no freeways intersect with each other except for the freeway\u0027s start or end, \u003c/li\u003e\u003cli\u003e freeways connect all $$$a+b$$$ cities (all freeways are bidirectional), \u003c/li\u003e\u003cli\u003e there are $$$r_j$$$ freeways that start from the $$$j$$$-th Berland city. \u003c/li\u003e\u003c/ul\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eInput contains one or several test cases. The first input line contains a single integer number $$$t$$$ ($$$1 \\le t \\le 3000$$$) — number of test cases. Then, $$$t$$$ test cases follow. Solve test cases separately, test cases are completely independent and do not affect each other.\u003c/p\u003e\u003cp\u003eEach test case starts with a line containing space-separated integers $$$a$$$ and $$$b$$$ ($$$1 \\le a, b \\le 3000$$$) — numbers of Algoland cities and number of Berland cities correspondingly.\u003c/p\u003e\u003cp\u003eThe next line contains $$$b$$$ space-separated integers $$$r_1, r_2, \\dots, r_b$$$ ($$$1 \\le r_b \\le a$$$) where $$$r_j$$$ is the number of freeways, that should start in the $$$j$$$-th Berland city. It is guaranteed that $$$r_1+r_2+\\dots+r_b\u003da+b-1$$$.\u003c/p\u003e\u003cp\u003eThe next $$$a$$$ lines contain coordinates of the Algoland cities — pairs of space-separated integers $$$xa_i, ya_i$$$ ($$$-10000 \\le xa_i, ya_i \\le 10000$$$). The next $$$b$$$ lines contain coordinates of the Berland cities — pairs of space-separated integers $$$xb_i, yb_i$$$ ($$$-10000 \\le xb_i, yb_i \\le 10000$$$). All cities are located at distinct points, no three of the $$$a+b$$$ cities lie on a single straight line.\u003c/p\u003e\u003cp\u003eSum of values $$$a$$$ across all test cases doesn\u0027t exceed $$$3000$$$. Sum of values $$$b$$$ across all test cases doesn\u0027t exceed $$$3000$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each of the $$$t$$$ test cases, first print \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eYES\u003c/span\u003e\" if there is an answer or \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eNO\u003c/span\u003e\" otherwise.\u003c/p\u003e\u003cp\u003eIf there is an answer, print the freeway building plan in the next $$$a+b-1$$$ lines. Each line of the plan should contain two space-separated integers $$$j$$$ and $$$i$$$ which means that a freeway from the $$$j$$$-th Berland city to the $$$i$$$-th Algoland city should be built. If there are multiple solutions, print any.\u003c/p\u003e"}},{"title":"Examples","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\u003e2\n2 3\n1 1 2\n0 0\n1 1\n1 2\n3 2\n4 0\n1 1\n1\n0 0\n0 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\n2 2\n1 2\n3 2\n3 1\nYES\n1 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}