#include using namespace std; template istream &operator>>(istream &is,vector &a){ for(auto &v : a) cin >> v; return is; } template ostream &operator<<(ostream &os,const vector &a){ if(a.size() == 0) return os; cout << a.at(0); for(int i=1; i> N >> M; vector> S(N,vector(N)); while(M--){ int a,b,s; cin >> a >> b >> s; S.at(a).at(b) = s; } vector P(N); iota(P.begin(),P.end(),0); int answer = 0; do{ int now = 0; for(int i=0; i