what is the error in my code while solving "The Name List"

i am solving the name list problem link : http://www.codechef.com/DCL1501/problems/DCL2015B
and my code is here: http://pastebin.com/KnSiVM2A . i am able to achieve proper output but while submitting it shows error… please suggest me .

hey hi shubh
i tried some sample tests on your code
here is the link


hope it will clear your doubt.