Giving wrong answer for inputs


#1

can somebody explaing why it is giving this o/p 4 5 6 NULL 7 NULL NULL on i/p 3 1 -1 -1


#2

Even I am getting this response for similar input (my input was 3 1 2 3).
But I went ahead and submitted the solution and it was accepted. So probably best to ignore the output on this test case