"В тридевятом царстве, в тридесятом государстве" ("in a Faraway Land") is a phrase that is used in numerous Russian fairytales.
Why is царство - тридевятое (3-9ое), and государство - тридесятое (3-10ое)? What is the origin of the phrase?
There is a number of ethnographic and cultural studies about what the тридевятое царство, тридесятое государство was in fact, but I believe, that is not the matter of your question.
Linguistically, тридесятый is an Old-Russian numeral denoting тридцатый, the thirtieth. And тридевятый seems to be a wordplay based on тридесятый and the fact that it is far enough for one to stop counting. (Compare: сто пятьсот раз.) The thirtieth kingdom and furthieth country, if you count from our border - that's how it can approximately be understood by the listener. Nobody knows the name of that country, for nobody's been there.
furtieth is a wordplay denoting a non-existing numeral. You can think of your own one if you please.