M Coloring Problem Algorithm