Generate recursively,AC