import copy N,M=tuple(map(int,input().split(' '))) x={} for i in range(M): temp1,temp2,temp3=tuple(map(int,input("").split(" "))) if temp2-1 not in x: x[temp2-1]=[] if temp1-1 not in x: x[temp1-1]=[] x[temp2-1].append([temp3,temp1-1]) x[temp1-1].append([temp3,temp2-1]) if True: dp=[[0 for j in range(N)] for i in range(1<