Two cases of polynomial-time solvability for the coloring problem