* "At top a castle" is grammatically incorrect. The preposition "at" needs an object (like "at the top").
* "In faraway land" is another misplaced modifier. It's unclear what is in the faraway land.
* "There slept lonely princess" is grammatically incorrect. "There" is an expletive that should be followed by the subject (princess) and then the verb (slept).
To fix the sentence, we need to rearrange the words and add some necessary elements:
A more grammatically correct version:
* "A lonely princess slept in a castle at the top of a faraway land."
* "In a faraway land, a lonely princess slept in a castle at the top of a hill."
This revised version clarifies the sentence's meaning by placing the subject ("princess") before the verb ("slept"), using appropriate prepositions, and specifying the location of the castle ("at the top of a hill").