Shortest Path
There is a path graph G=(V,E)G=(V,E) with nn vertices. Vertices are numbered from 11 to nn and there is an edge with unit length between iiand i + 1i+1 (1 le i < n)(1≤i<n). To make the graph more interesting, someone adds three more edges to the graph. The length of each new edge is 11.
You are given the graph and several queries about the shortest path between some pairs of vertices.
There are multiple test cases. The first line of input contains an integer TT, indicating the number of test cases. For each test case:
The first line contains two integer nn and mm (1 le n, m le 10^5)(1≤n,m≤105) -- the number of vertices and the number of queries. The next line contains 6 integers a_1, b_1, a_2, b_2, a_3, b_3a1,b1,a2,b2,a3,b3 (1 le a_1,a_2,a_3,b_1,b_2,b_3 le n)(1≤a1,a2,a3,b1,b2,b3≤n), separated by a space, denoting the new added three edges are (a_1,b_1)(a1,b1), (a_2,b_2)(a2,b2), (a_3,b_3)(a3,b3