# bzoj3495 PA2010 Riddle（2-sat+建图优化）

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <stack>
using namespace std;
#define inf 0x3f3f3f3f
#define N 3000010
#define M 12000010
#define ll long long
inline char gc(){
static char buf[1<<16],*S,*T;
return *S++;
}
int x=0,f=1;char ch=gc();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=gc();}
while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=gc();
return x*f;
}
int n,tot=0,m,h[N<<1],num=0,dfn[N<<1],low[N<<1],dfnum=0,bel[N<<1],scc=0;
bool inq[N<<1];stack<int>qq;
struct edge{
int to,next;
}data[M];
data[++num].to=y;data[num].next=h[x];h[x]=num;
}
inline void tarjan(int x){
dfn[x]=low[x]=++dfnum;qq.push(x);inq[x]=1;
for(int i=h[x];i;i=data[i].next){
int y=data[i].to;
if(!dfn[y]) tarjan(y),low[x]=min(low[x],low[y]);
else if(inq[y]) low[x]=min(low[x],dfn[y]);
}if(low[x]==dfn[x]){
++scc;while(1){
int y=qq.top();qq.pop();inq[y]=0;
bel[y]=scc;if(y==x) break;
}
}
}
int main(){
//  freopen("a.in","r",stdin);
while(m--){
}tot=n;
while(K--){
for(int i=1;i<=m;++i){
if(i==1){
}else{
y+=m;
if(i==m){
}