Terrorists

Given a connected graph with at most 50 extra edges past a tree, answer the shortest distance for each query pair.

Medium7Shortest pathTreeNo attempts yetTime limit5sMemory limit256 MB

Problem

The neighbourhood is described by intersections and roads. Terrorists gather at one intersection and then move to another intersection to commit a crime. The information the police collected records the meet up intersection and the destination intersection of each plan, but not the time.

The police are short of officers and cannot stop every crime on the spot. Instead they install a surveillance camera at every meet up intersection, and once a gathering is detected they head for that plan's destination. Terrorists always travel between intersections along a shortest route.

For each plan, compute the shortest distance between the meet up intersection and the destination intersection.

Input

The first line contains the number of test sets TT. (1T51 \le T \le 5)

The first line of each test set contains the number of intersections NN, the number of roads MM, and the number of terrorist plans QQ, in that order. (1N1000001 \le N \le 100000, N1MN+50N - 1 \le M \le N + 50, 1Q500001 \le Q \le 50000)

Each of the next MM lines describes one road with three integers UU, VV, DD. UU and VV are the two intersections the road joins, and DD is its length. (1U,VN1 \le U, V \le N, 1D100001 \le D \le 10000) Several roads may join the same pair of intersections, and a road may have UU equal to VV. Every road is bidirectional, and every intersection is reachable from every other intersection.

Each of the next QQ lines describes one plan with two integers SS and EE. SS is the meet up intersection and EE is the destination intersection. (1S,EN1 \le S, E \le N)

Output

For each test set, first print Case x:, where xx is the test set number starting from 1. Then print QQ lines, one per plan in the order given in the input, each holding the shortest distance between that plan's meet up intersection and its destination intersection.