General templates for queries, trans, G_queries. See paper.pdf.