#include #include #include using namespace atcoder; using mint = modint1000000007; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 100000000000000000 int main(){ int N,M; cin>>N>>M; vector a(M),b(M),s(M); rep(i,M)cin>>a[i]>>b[i]>>s[i]; vector t(N); rep(i,N)t[i] = i; int ans = 0; do{ int sum = 0; rep(i,M){ if(t[a[i]]