{"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\"\u003eBeing an ACMer requires knowledge in many fields, because problems in this contest may use physics, biology, and even musicology as background. And now in this problem, you are being a city architect!\u003cbr\u003eA city with N towns (numbered 1 through N) is under construction. You, the architect, are being responsible for designing how these towns are connected by one-way roads. Each road connects two towns, and passengers can travel through in one direction.\u003cbr\u003e\u003cbr\u003eFor business purpose, the connectivity between towns has some requirements. You are given N non-negative integers a1 .. aN. For 1 \u0026lt;\u003d i \u0026lt;\u003d N, passenger start from town i, should be able to reach exactly ai towns (directly or indirectly, not include i itself). To prevent confusion on the trip, every road should be different, and cycles (one can travel through several roads and back to the starting point) should not exist.\u003cbr\u003e\u003cbr\u003eYour task is constructing such a city. Now it\u0027s your showtime!\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line is an integer T (T \u0026lt;\u003d 10), indicating the number of test case. Each test case begins with an integer N (1 \u0026lt;\u003d N \u0026lt;\u003d 1000), indicating the number of towns. Then N numbers in a line, the ith number ai (0 \u0026lt;\u003d ai \u0026lt; N) has been described above."}},{"title":"Output","value":{"format":"HTML","content":"For each test case, output \"Case #X: Y\" in a line (without quotes), where X is the case number starting from 1, and Y is \"Yes\" if you can construct successfully or \"No\" if it\u0027s impossible to reach the requirements.\u003cbr\u003e\u003cbr\u003eIf Y is \"Yes\", output an integer M in a line, indicating the number of roads. Then M lines follow, each line contains two integers u and v (1 \u0026lt;\u003d u, v \u0026lt;\u003d N), separated with one single space, indicating a road direct from town u to town v. If there are multiple possible solutions, print any of them.\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\u003e3\r\n3\r\n2 1 0\r\n2\r\n1 1\r\n4\r\n3 1 1 0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: Yes\r\n2\r\n1 2\r\n2 3\r\nCase #2: No\r\nCase #3: Yes\r\n4\r\n1 2\r\n1 3\r\n2 4\r\n3 4\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}