"They found the correct entrance, but afterwards lost their way."
Translation:Ili trovis la ĝustan enirejon, sed perdis poste la vojon.
OK, so I was wondering this too. Here's Ivy Kellerman on the topic, from her Complete Grammar of Esperanto:
"42. Since there is a special reﬂexive pronoun of the third person, the third personal pronouns, li, ŝi, ĝi, ili, when used otherwise than as subjects, never refer to the subject of the verb, but always to some other person or thing"
So keeping track of the subject of the current verb is important. Note in particular that nouns that follow prepositions cannot be the subject of the verb.