replaces q with said element in dialogues