{"trustable":false,"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":"\u003cscript type\u003d\u0027text/x-mathjax-config\u0027\u003eMathJax.Hub.Config({tex2jax: { inlineMath: [[\u0027$\u0027,\u0027$\u0027]] } }); \u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027 src\u003d\u0027https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\u0027\u003e\u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027\u003esetTimeout(function(){MathJax.Hub.Queue([\u0027Typeset\u0027, MathJax.Hub, \u0027left_view\u0027]);}, 2000);\u003c/script\u003e\n\u003cdiv class\u003d\"panel_content\"\u003e\n 一天zjx想和她的长老一起去百盛看电影。然而zjx在21b#573而长老在天美,因此他们想先集合然后一起出发去百盛。因为他们很恩爱所以他们想尽快和彼此会和。\u003cbr\u003e\n现给出一张有n个点的图,(zjx和长老可以在这n个任意一个点中会和),规定1为21b#573,n为天美。\u003cbr\u003e\n现在有m种传送阵,分布在各个点上,每个相同的传送阵可以相互传送,但需要花费ti分钟。\n问zjx和长老需要花费多长时间才能见到面\u003cbr\u003e\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":" 第一行输入一个整数T(1\u003c\u003dT\u003c\u003d6),表示样例数。紧接着T行\u003cbr\u003e\n第一行输入两个整数n,m(2\u003c\u003dn\u003c\u003d10^5).之后紧接着m行代表每种传送阵\u003cbr\u003e\n每行包括两个整数ti(1\u003c\u003dti\u003c\u003d10^9),si。ti表示在这种传送阵中传送需要消耗ti时间,si表示这种传送阵分布在si个地方,\n紧跟着输入si个数来表示该传送阵所处的点编号。\u003cbr\u003e\n保证si的和小于等于10^6."}},{"title":"Output","value":{"format":"HTML","content":"对于每一组样例,如果他们不能会和,则输出一行\"Evil John\"(没有引号)\u003cbr\u003e\n如果能,则输出两行,第一行一个整数代表他们需要花费的时间\u003cbr\u003e\n第二行代表他们可能相聚的地点。如果有多种可能,以一个递增序列将他们全输出出来"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e2\n5 4\n1 3 1 2 3\n2 2 3 4\n10 2 1 5\n3 3 3 4 5\n3 1\n1 2 1 2\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003eCase #1: 3\n3 4\nCase #2: Evil John\n\n \n \u003ci style\u003d\"font-size:1px\"\u003e \u003c/i\u003e\u003c/pre\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cpre\u003e\nIn the first case, it will take Bessie 1 minute travelling to the 3rd block, and it will take Elsie 3 minutes travelling to the 3rd block. It will take Bessie 3 minutes travelling to the 4th block, and it will take Elsie 3 minutes travelling to the 4th block. In the second case, it is impossible for them to meet.\n\n \n \u003c/pre\u003e"}}]}