you made mistake on your loop. Because you used double for loop
So process completed the first for loop and print the statement after that that will be go to another one.

So print your output...