Picard: Thank you.
Q: For what?
Picard: You had a hand in helping me get out of this.
Q: I was the one that got you into it; a directive from the Continuum. The part about the helping hand, though... was my idea.
Picard is thanking Q for helping him to get out of his dilemma in trying to save all of humanity.