Query regarding output of PRGIFT

This question is regarding the question given here: http://www.codechef.com/AUG14/problems/PRGIFT

What output will be expected for the following input:

1
3 2
2 3 4

Any help is appreciated. Thanks in advance.

Sorry, It’s not permitted because contest is on and according to rules, you are not allowed to ask for help of any kind.