#include <bits/stdc++.h>
using namespace std;
#define int long long
#define dd double
#define ld long double
#define ull unsigned long long
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define el "\n"
#define Arwa ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fix(x) cout << fixed << setprecision(x)
#define all(v) v.begin(),v.end()
#define dpp(v,val) memset(v,val,sizeof(v))
#define mod 1e9+7
#define N 100005
int n;
int vis[N];
vector<int>adj[N];
bool valid=true; 
vector<int>ans;
void dfs_rec(int node,int type)
{
    vis[node]=type;
    for(int i=0;i<adj[node].size();i++)
    {
        int ch=adj[node][i];
        if(vis[ch])
        {
            if(vis[ch]==type)
            valid=0;
            continue;
        }
        dfs_rec(ch,3-type);
    }
}

void HereWeGoAgain()
{
   int m; cin>>m;
   for(int i=0;i<=N;i++)
   vis[i]=0, adj[i].clear();
   for(int i=0;i<m;i++)
   {
    int x,y; cin>>x>>y;
    adj[x+1].push_back(y+1);
    adj[y+1].push_back(x+1); 
   }
   valid=1;
   for(int i=1;i<=n;i++)
   {
    if(!vis[i]) dfs_rec(i,1);
   }
   if(valid)
   cout<<"BICOLORABLE."<<el;
   else 
   cout<<"NOT BICOLORABLE."<<el;
}
int32_t main() 
{
    Arwa
    int t=1;
    //cin>>t;
    //for(int i=1;i<=t;i++)
    cin>>n;
    while(n!=0)
    {
    HereWeGoAgain();
    cin>>n;
    }
    return 0;
} 
