#include <iostream> //可用1和-1代表相反(色)
#include<unordered_map>
#include<vector>
using namespace std;
int main(){
int n;
while(cin>>n&&n){
int l;
cin>>l;
unordered_map<int,vector<int>> unmap;
string s="BICOLORABLE.";
int visit[n],color[n];
for(int i=0;i<n;i++){
visit[i]=0;
color[i]=1;
if(!unmap[i].empty()){
unmap[i].clear();
}
}
for(int i=0;i<l;i++){
int a,b;
cin>>a>>b;
unmap[a].push_back(b);
unmap[b].push_back(a);
}
for(int i=0;i<n;i++){
if(visit[i]==0){
visit[i]=1;
while(!unmap[i].empty()){
color[unmap[i].back()]= - color[i];
visit[unmap[i].back()]=1;//cout<<unmap[i].back()<<endl;
unmap[i].pop_back();
// cout<<unmap[i].back()<<endl;
}
}else{
while(!unmap[i].empty()){
if(color[i]==color[unmap[i].back()]){
s="NOT BICOLORABLE.";
break;
}unmap[i].pop_back();
// unmap[i].erase(unmap[i].end()); //會錯,要用vec.pop_back();
}
}
if(s=="NOT BICOLORABLE.") break;
}
cout<<s<<endl;
}
return 0;
}