gCampus (Large)

Find every road that never appears on a shortest travel-time path between any pair of offices.

Medium5Shortest pathGraphNo attempts yetTime limit5sMemory limit512 MB

Problem

Company G has a main campus with NN offices, numbered 0 to N1N-1, and MM bidirectional roads, numbered 0 to M1M-1. Road ii connects office UiU_i and office ViV_i, and travelling on it takes CiC_i minutes in either direction.

A path between office XX and office YY is a sequence of one or more roads that starts at XX and ends at YY. The time taken to travel a path is the sum of the times of the roads that make it up. Every pair of offices is connected by at least one path.

Company G works on efficient transport, but the CEO has just realized that the company's own road network may be suboptimal. She wants to know which roads on the campus are inefficient. A road is inefficient if and only if it lies on no shortest path between any two offices.

Given the graph of offices and roads, find every inefficient road.

Input

The first line of the input contains the number of test cases, TT. TT test cases follow. Each case begins with a line holding two integers NN and MM, the number of offices and the number of roads. Then follow MM lines with three integers each, UiU_i, ViV_i and CiC_i, meaning that road ii runs between office UiU_i and office ViV_i and takes CiC_i minutes to travel.

Limits

  • 0<Ci10000000 < C_i \le 1000000
  • 1T31 \le T \le 3
  • 1N1001 \le N \le 100
  • 1M100001 \le M \le 10000

Output

For each test case, output one line containing Case #x:, where xx is the test case number starting from 1. Then output the numbers of all inefficient roads in increasing order, one per line. If there is no inefficient road, output only the Case #x: line. Road 0 is the first road listed in that test case, road 1 is the second one, and so on.