Could you help with with one test case

this is my code: https://onlinegdb.com/JAAsiijbd

you have not consider the case of circular array

array is cirular
for input
4
4 1 2 3
Correct Output
-1 2 3 4
Your Output
-1 2 3 -1

Correct Code