int z[3d5]; graph g; void f(int i){ rep[g.edge[i]](j,g.es[i])if(!z[j])z[j]=i,f(j); } { int@n,m,a[n],b[],r[n+1]; rd((a,b)(n)); g.setEdge(n+1,n,a,b); m=g.anUndirectedCycle(r); f(*r); rep(i,m)z[r[i]]=r[i+1]; rep(i,n)wt(z[a[i]]-b[i]?"<-":"->"); }