spoj k-query. Given lots of offline queries and updates, reoder the queries and updates so that they maybe efficiently preprocessed.