void Tarjan(int x){
low[x] = dfn[x] = ++tot;
st[++top] = x;
for(int i=1;i<=n;i++)
if(a[x][i]==1){
if(dfn[i]==0){
Tarjan(i);
low[x] = min(low[x],low[i]);
}
else if(!co[i])
low[x] = min(low[x],dfn[i]);
}
if(low[x]==dfn[x]){
co[x] = ++col;
ct[col] = cc[x];
while(st[top]!=x){
co[st[top]] = col;
ct[col] = min(ct[col],cc[st[top]]);
--top;
}
--top;
}
}