{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e A number of cities are connected by a network of highways. Each highway is bidirectional and connects two cities, with a given travel time. What is the shortest time to get from a given city to another given city? Help Aliya reach her destinations in the shortest time possible.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cpre\u003e\r\n\u003c/pre\u003e \n\u003cp\u003e The first line of input contains the number of test cases.\u003cbr /\u003e \u003cbr /\u003e Each test case starts with a line containing the number of cities n (2 ≤ n ≤ 100000), the number of highways m (1 ≤ m ≤ 100000), the starting city and the ending city. Cities are numbered from 1 to n.\u003cbr /\u003e \u003cbr /\u003e Then m lines follow, each describing one highway. The\u0026nbsp;description\u0026nbsp;consists of the two distinct city numbers and the time in minutes to travel along the highway. The time will be between 1 and 1000.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cpre\u003e\r\n\u003c/pre\u003e \n\u003cp\u003e For each test case output a single line containing the minimum time it takes to get from the start to the destination. If no connection exists, output NONE.\u003c/p\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e\r\n\u003cb\u003eInput:\u003c/b\u003e \r\n2\r\n\r\n4 2 1 4\r\n1 2 5\r\n3 4 5\r\n\r\n4 4 1 4\r\n1 2 5\r\n2 3 5\r\n3 4 5\r\n4 2 6 \u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e\r\n\u003cb\u003eOutput:\u003c/b\u003e \r\nNONE\r\n11\r\n\u003c/pre\u003e"}}]}