This takes queries and give output.