N,M = map(int,input().split()) scores = [[0]*N for _ in range(N)] for _ in range(M): i,j,score = map(int,input().split()) scores[i][j] = score dp = [[0]*N for _ in range(1<