gCampus (Small)

For each road, decide whether it lies on a shortest path between some pair of offices and list the ones that never do.

Medium4Shortest pathGraphInterviewNo attempts yetTime limit5sMemory limit512 MB

Problem

The main campus of company G has NN offices, numbered 0 to N1N-1, and MM bidirectional roads, numbered 0 to M1M-1. Road ii joins offices UiU_i and ViV_i, and travelling along it takes CiC_i minutes in either direction.

A path between two different offices XX and YY is a sequence of one or more roads that starts at XX and ends at YY. The time of a path is the sum of the times of the roads that make it up. At least one path exists between every pair of offices. A shortest path between two offices is a path of minimum total time, and there can be several of them.

Company G sells efficient transport, and the CEO has just realised that her own road network may not be optimal. She wants to know which roads on the campus are inefficient. A road is inefficient when no shortest path between any two different offices contains it.

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

Input

The first line contains the number of test cases TT. Each test case begins with a line holding two integers NN and MM, the number of offices and the number of roads. MM lines follow, each with three integers UiU_i, ViV_i and CiC_i: road ii joins offices UiU_i and ViV_i and takes CiC_i minutes.

Several roads may join the same pair of offices, and a road may have the same office at both ends.

Limits

  • 1T101 \le T \le 10
  • 1N=M1001 \le N = M \le 100
  • 0<Ci10000000 < C_i \le 1000000
  • 0Ui,ViN10 \le U_i, V_i \le N-1

Output

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