#include #include #include #include using namespace std; typedef pair P; typedef long long int ll; ll dfs(int now); int n,m; vector

data[101]; bool used[101]; bool flg[101]; ll cou[101]; int main(){ cin >> n >> m; memset(flg,true,n+2); for(int i=0;i> a >> b >> c; a--; c--; data[a].push_back(P(c,b)); flg[c] = false; } memset(cou,0,n+1); for(int i=0;i