#include#include
#include #include #define FORa(i,s,e) for(int i=s;i<=e;i++)#define FORs(i,s,e) for(int i=s;i>=e;i--)#define gc getchar()//pa==pb&&(pb=(pa=buf)+fread(buf,1,10000,stdin),pa==pb)?EOF:*pa++#define File(name) freopen(name".in","r",stdin),freopen(name".out","w",stdout);using namespace std;static char buf[10000],*pa=buf,*pb=buf;inline int read();const int N=100;int n,m;struct Edge{ int to,dis; bool operator <(const Edge &a) const //运算符重载,快排需要用,并且符号要与sort排序比较方式的符号一致 { return to l[N];list ::iterator it;int main(){ int from,to,dis; n=read(),m=read(); FORa(i,1,m) from=read(),to=read(),dis=read(),l[from].push_back((Edge){to,dis});//直接存入结构体方法 strcut pp=(struct){a,b,c} FORa(i,1,n) l[i].sort(); FORa(i,1,n) { for(it=l[i].begin();it!=l[i].end();it++) cout<<(it->to);//<<" "< dis<<" "; cout< '9') f=c=='-'?-1:1,c=gc; while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=gc; return x*f;}/*6 51 2 11 3 12 4 12 5 12 6 1*/