HACKERRANK: Sherlock and Queries (incomplete)

https://www.hackerrank.com/challenges/sherlock-and-queries