import java.util.Scanner;

public class Main{

    private static boolean[][] adj = null;
    private static int[] color = null;
    private static int n = 0;

    private static boolean rec(int i, int c){
	if (color[i] != 0)
	    return (c != color[i]);
	
	color[i] = 2 - c + 1;

	for (int j = 0; j < n; j++){
	    if (i == j) continue;
	    if (adj[i][j] && !rec(j,color[i])) return false;
	}
	return true;
    }

    public static void main(String args[]){

	Scanner in = new Scanner(System.in);

        n = in.nextInt();
	while(n != 0){
	    adj = new boolean[n][n];
	    color = new int[n];

	    int l = in.nextInt();
	    for (int i = 0; i < l; i++){
		int a = in.nextInt();
		int b = in.nextInt();
		adj[a][b] = true;
		adj[b][a] = true;
	    }

	    if (rec(0,1))
		System.out.println("BICOLORABLE.");
	    else
		System.out.println("NOT BICOLORABLE.");

	    n = in.nextInt();

	}

    }

}
