There is a sentence in Lingua Latina per se Illustrata Chap. 28 that I can't understand.
Lydia libellum, quem adhuc intra vestem occultavit, promit et Medo ostendit. Qui manum extendens libellum apprehendit et "Qui liber est iste?" inquit.
What is the first qui for?
I thought it should be a relative pronoun identical to Medo, but why is it capitalized in another sentence instead of in the previous one?
What is the verb for the main clause and what for the subordinate clause?