# Rank of Tetris

Problem Description

Input

Output

Sample Input
```3 3
0 > 1
1 < 2
0 > 2
4 4
1 = 2
1 > 3
2 > 0
0 > 1
3 3
1 > 0
1 > 2
2 < 1```

Sample Output
```OK
CONFLICT
UNCERTAIN```

```#include<stdio.h>
#include<string.h>
#include<queue>
using namespace std;
int cnt[10200];
int par[10200];
struct node {
int next;
int to;
} edge[20200];
struct cmpop {
int x;
char op;
int y;
} a[20200];
cnt[v]++;
}
int find(int m) {
if(par[m]==m)
return m;
else
return par[m]=find(par[m]);
}
bool unite(int x,int y) {
x=find(x);
y=find(y);
if(x==y)
return false;
par[y]=x;
return true;
}
int main() {
int m;
while(scanf("%d %d",&n,&m)!=EOF) {
memset(cnt,0,sizeof(cnt));
for(int i=0; i<n; i++)
par[i]=i;
int num=n;
for(int i=0; i<m; i++) {
scanf("%d %c %d",&a[i].x,&a[i].op,&a[i].y);
if(a[i].op=='=')
if(unite(a[i].x,a[i].y))
num--;
}
for(int i=0; i<m; i++) {
if(a[i].op!='=') {
int x=find(a[i].x),y=find(a[i].y);
if(a[i].op=='>')
else
}
}
queue<int>q;
for(int i=0; i<n; i++) {
if(!cnt[i]&&i==find(i)) {
q.push(i);
}
}
bool flag=false;
while(!q.empty()) {
if(q.size()>1)
flag=true;
int top=q.front();
q.pop();
num--;
cnt[edge[i].to]--;
if(!cnt[edge[i].to])
q.push(edge[i].to);
}
}
if(num>0)
printf("CONFLICT\n");
else if(flag)
printf("UNCERTAIN\n");
else
printf("OK\n");
}
return 0;
}
```