i should use backtrack here,but do not understand it well enough