How do You Spell 12th?

12th is spelled twelfth. You might think it should be twelvth, since twelve is spelled with a v, not an f. But for some reason the f is correct.