import java.util.*; class Node { int u, v, w; Node(int u, int v, int w) { this.u = u; this.v = v; this.w = w; } } class _1865 { static boolean bellman_ford(Node[] edges, Node info) { int N = info.u; int M = info.v; int W = info.w; int[] distance = new int[N+1]; Arrays.fill(distance, 0); for(int n=0; n distance[current] + time) { if(n==N-1) return true; distance[next] = distance[current] + time; } } } return false; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for(int t=0; t