First working version of the query to find candidates for constants