{"trustable":false,"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":"\u003cstyle type\u003d\u0027text/css\u0027\u003e .input, .output {border: 1px solid #888888;} .output {margin-bottom:1em;position:relative;top:-1px;} .output pre,.input pre {background-color:#EFEFEF;line-height:1.25em;margin:0;padding:0.25em;} .title {background-color:#FFFFFF;border-bottom: 1px solid #888888;font-family:arial;font-weight:bold;padding:0.25em;} \u003c/style\u003e \u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027]], displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027]]}\n });\n \u003c/script\u003e\n \u003cscript type\u003d\"text/javascript\" async\n src\u003d\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\"\u003e\n \u003c/script\u003e\n\u003cp\u003eRahim, One of our colleague\u0027s cousins came to Dhaka for the first time in his life. Unfortunately, No one went to pick him up from Gabtoli Bus Station. But he brought a map of Dhaka with him. Now he wants to find a way to reach Mogbazar from Gabtoli by looking at the map. Can you help him to find the shortest way to reach his destination?\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains two integers \u003cstrong\u003es\u003c/strong\u003e and \u003cstrong\u003et\u003c/strong\u003e (2 ≤ s ≤ 10^5, 0 ≤ t ≤ 10^5), where \u003cstrong\u003es\u003c/strong\u003e is the number of towns and \u003cstrong\u003et\u003c/strong\u003e is the number of roads. Following \u003cstrong\u003et\u003c/strong\u003e lines contain one road each in form \u003cstrong\u003exi\u003c/strong\u003e, \u003cstrong\u003eyi\u003c/strong\u003e and \u003cstrong\u003ezi\u003c/strong\u003e (1 ≤ \u003cstrong\u003exi, yi\u003c/strong\u003e ≤ \u003cstrong\u003es\u003c/strong\u003e, 1 ≤ \u003cstrong\u003ezi\u0026nbsp;\u003c/strong\u003e ≤ 106), where \u003cstrong\u003exi, yi\u003c/strong\u003e are towns endpoints and \u003cstrong\u003ezi\u003c/strong\u003e is the length of the roads in km.\u003c/p\u003e\n\u003cp\u003eIt is possible that the map has loops and multiple roads between pair of towns.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eConsidering town 1 as Gabtoli and town s as Mogbazar,\u0026nbsp;\u0026nbsp;Write the shortest path to reach the destination. If there are many solutions, print any of them. If there is no path, print -1.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003cdiv class\u003d\"sample-test\"\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e3 3\u003cbr\u003e1 2 1\u003cbr\u003e3 1 2\u003cbr\u003e2 3 1\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e1 3\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e10 10\u003cbr\u003e1 5 12\u003cbr\u003e2 4 140\u003cbr\u003e2 10 149\u003cbr\u003e3 6 154\u003cbr\u003e3 7 9\u003cbr\u003e3 8 226\u003cbr\u003e3 10 132\u003cbr\u003e4 10 55\u003cbr\u003e5 8 33\u003cbr\u003e7 8 173\n\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e1 5 8 7 3 10 \u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}}]}