N, M = map(int, input().split()) INF = 10**10 cost = [[INF]*N for _ in range(N)] # 重み l = [] for e in range(M): s, t, d = map(int,input().split()) l.append((s,t,d)) for i in range(N-1): for j in range(i, N): a, b, c = l[i] cost[i][j] = c cost[j][i] = c dp = [[INF] * N for _ in range(1<