#include #include #include #include using namespace std; const int maxn=5005; const int maxm=200005; struct Edge { int v,w; Edge *next; }; Edge *G[maxn],mem[maxm*2],*ecnt=mem; inline void AddEdge(int u,int v,int w) { ecnt->v=v; ecnt->w=w; ecnt->next=G[u]; G[u]=ecnt++; } int n,m,inq,res; typedef pair PII; #define mkp make_pair priority_queue,greater > Q; int dis[maxn]; bool vis[maxn]; int main() { scanf("%d%d",&n,&m); for(int i=0;inext) if(it->wv]) dis[it->v]=it->w,Q.push(mkp(dis[it->v],it->v)); } if(inq==n) printf("%d\n",res); else printf("orz\n"); return 0; }