optimal heuristic working (lacks backtrack)