Context Word: contacts. 
Question: PersonX wore contacts for their eyes while PersonY wore glasses, so _ took out their contacts before going to sleep. 
Answer: PersonX
PersonX wore contacts for their eyes while PersonY wore glasses, so _ took off their glasses before going to sleep.