The Scientific Committee has hidden from you a permutation P of all the integers from 1 to N. (3 ≤ N ≤ 256). You need to find it. Permutation P is fixed (the grader is not adaptive).
In your endeavor, you are allowed to ask queries that take as parameter another permutation V of all the integers from 1 to N:
query(V) will return sum(i = 1..N - 1, abs(P[V[i]] - P[V[i + 1]])).
Performing a number of queries, you are to discover permutation P, or any other permutation P' that is indistinguishable from P. Two permutations are indistinguishable if queried in all possible ways they both yield the same answers.