#include #include #include using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n,m; cin>>n>>m; vector> g(n); vector>> use(n); vector cnt(n,0); for(int i = 0;i>p>>q>>r; p--;r--; g[p].push_back(r); use[r].push_back(make_pair(p,q)); cnt[r]++; } vector> dp(n,vector(n,0)); vector que; for(int i = 0;i