Queries on a Permutation With Key — CaffeCode