Fiction isn't necessarily a good guide to how a culture thinks about sex and gender--indeed, in some cases social anxieties are worked out in fiction in ways that would not be tolerated in real life--but it can be a space where we see the culture thinking about the subject. This medieval Japanese tale gets even more convoluted than the most extreme of Shakespeare's cross-gender plots.