This is the more logical answer because he word escribió is a conjugated verb that comes from the verb escribir and stands for the third person singular because Marta can be replaced by ella, and the tense of this sentence is the preterite that talks about action that took place or were completed at a certain moment in the past. Finally:
Marta escribió una carta cuando Justo entró (Marta wrote a letter when Justo came in)