Why it didn't pass all the test cases? Whats Wrong in it?

https://ide.codingblocks.com/s/279398

Check your code with this input:
5
1 2 3 5 6
1
4

Expected O/p:
-1 -1
If that query is not in that array, you are suppose to print -1.