int dfn[maxn],low[maxn];
int vis[maxn],col[maxn];
int sta[maxn];
int color,cnt,tot;
int n,m;
void tarjan(int u) //模板
{
cnt++;
dfn[u]=low[u]=cnt;
vis[u]=1;
sta[++tot]=u;
for(int i = head[u];i != -1;i = edge[i].nx)
{
int v = edge[i].v;
if(dfn[v]==-1)
{
tarjan(v);
low[u]=min(low[u],low[v]);
}
else if(vis[v])
low[u]=min(low[u],low[v]);
}
if(dfn[u]==low[u])
{
color++;
col[u]=color;
vis[u]=0;
while(sta[tot]!=u)
{
col[sta[tot]]=color;
vis[sta[tot]]=0;
tot--;
}
tot--;
}
}
int two_sat()
{
memset(dfn,-1,sizeof(dfn));
for(int i=0; i< n<<1; i++) //模板
{
if(dfn[i]==-1)
{
tarjan(i);
}
}
for(int i=0; i<n; i++) //模板
{
int x = i<<1;
int y = i<<1|1;
if(col[i<<1]==col[i<<1|1])
{
return 0;
}
}
return 1;
}