Jalastu fī d-dāri, wa-fī s-sūqi, wa-fī l-masjidi
The conjunction “wa” joins the location phrases, and the source repeats fī before each place.
In “wa-fī s-sūqi”, “wa” is conjunctive, fī a preposition, and sūqi genitive. The mosque phrase follows the same analysis.