#include using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i>n>>m; int d[n][n]; rep(i,m){ int a,b,c; cin>>a>>b>>c; a--; b--; d[a][b]=c; if(i==0) st=a; } int temp=st; cout<