In most mammals, us included, biological sex is determined by a lottery between two letters: X and Y, the sex chromosomes. Inherit one X each from mom and dad, and develop ovaries, a womb and a vagina. Inherit an X from mom and a Y from dad, and develop testes and a penis.

But there are rare, mysterious exceptions. A small number of rodents have no Y chromosomes, yet are born as either females or males, not hermaphrodites. Now, scientists may be one step closer to figuring out how sex determination works in one of these rodents.

In a study published in Science Advances on Friday, Japanese scientists suggested that cells of the endangered Amami spiny rat, from Japan, are sexually flexible and capable of adapting to either ovaries or testes. When the researchers injected stem cells derived from a female rat into male embryos of laboratory mice, the cells developed into and survived as sperm precursors in adult males. The result was surprising since scientists have never been able to generate mature sperm from female stem cells, largely because sperm production normally requires the Y chromosome.

Found only in the subtropical forests of an island in Japan called Amami Oshima, Amami spiny rats are threatened by habitat destruction, competition with black rats not native to the island and predation by mongooses and feral cats and dogs. Their range has been reduced to less than 300 square miles, an area smaller than New York City.