const int N=100000,M=200000;
int n,m,cnt=1,num,col,low[N+10],dfn[N+10],head[N+10],to[M+10],nex[M+10];
inline void add(int x,int y){to[++cnt]=y,nex[cnt]=head[x],head[x]=cnt;}
stack<int> st;
vi ve[N+10];
void tarjan(int x,int fromi)
{
dfn[x]=low[x]=++num,st.e(x);
for(int i=head[x];i;i=nex[i])
{
if(i==(fromi^1))continue;
if(!dfn[to[i]])tarjan(to[i],i),low[x]=min(low[x],low[to[i]]);
else low[x]=min(low[x],dfn[to[i]]);
}
if(low[x]==dfn[x])
{
int y;++col;
do ve[col].eb(y=st.top()),st.pop();while(y!=x);
}
}