How did you fail ? You are Xenor Tarkal, the most powerful shadow mage of all the unified human empire, a member of the 9th circle of the Imperial Academy of Arcanes and, according to most people, the next-in-line for the position of Archmage. You are skilled in all kinds of magic, even if Shadow Magic is your specialty. You can conjure solid, sharp shadows can can cut through any shield, you can protect yourself with a wall of solid shadows or become invisible. You can control people like pupets by controlling their shadows, you can blind your ennemies and your magic is strong enough to cast almost any spell.
That is why you won so many duels and magical tournaments; people admire you and your ennemies fear you. So when you heard rumors about a "Dark Master" trying to extend his evil dominion, you decided to show him who commands the Shadows. You were confident enought to go there alone and storm his castle. In fact, you killed many of his minions without breaking a sweat. When you arrived in the throne room, the Dark Master faced you alone. What happened next is beyond your understanding. The Dark Master cancelled all your spells, or turn them against you. He blinded you. He controlled your body like a puppet. He could have killed you easily.
But he didn't. The Dark Master simply imprisonned you after making sure you cannot use your magic with a "triple seal" curse: three magical runes are tatooed on your skin, each of them is powerful enough to neutralize your magical abilities. But the Dark Master had made a huge mistake, because the curse he used has two drawbacks:
1) the "triple seal curse" is conditional magic, meaning it only works if the victim (you) has some specific physical or mental characteristics
2) each seal prevents you to use any magic except for the very specific spell that you need to change your physical or mental state to "unlock" the seal.
In fact, many mages consider this "curse" as a simple, 3-steps puzzle: you simply have to figure out which spell you need to break the first seal, cast it and do the same for the two other seals. And since the so-called "Dark Master" underestimates you so much he simply locked you up in a room with a large library, you just have to do some research to understand the meaning of each seal. And once you will remove the curse, nothing, not the two guards outside your prison, not the Dark Master himself can prevent you from escaping and having your revenge.
You don't want to waste any time. You look at the first rune, research its meaning. Two hours later, you found the first condition: the seal prevents you to use magic unless you are a woman. It means you can cast a gender-bending spell, make yourself a woman an break the first seal. What's the problem anyway ? Once you have broken the 3 seals, you will be able you cast any spell, including a spell to make you a man again. You'll be a woman only for a few hours, just the time to research and break the other two seals.