coder_penguin's submission of Nasty Queries | CodeChef