Upvote:1
In France/Germany.
When you fly to Brazil and connect to a domestic flight, for example if flying to Sao Paulo via Rio de Janeiro, you still enter Brazil in Rio and thus get your stamp there.
Same thing here, because the Schengen area is effectively a single country. Since you're making a "domestic" connection (France-Italy or Germany-Italy) you need to clear immigration in France or Germany and get your stamp there.
Make sure you do get stamped, as many officers (especially in France) are too lazy to do it, and contrary to popular belief, entries and exits to/from the Schengen Area are not electronically recorded