Please share the solution for Name Game problem

I tried to solve Name Game problem but could not able to do it. I request to please share the code for Name Game problem.

This one: Contest Page | CodeChef ?

Thank you. But, I need the solution for the Name Game problem which was asked in Lowe’s India hiring challenge. Is this the right place to post?