How to take input in problem ANARC07G on spoj?

How to take input in problem ANARC07G on spoj?
i mean how to store data in such a way that i ca n find out who is having how many children and their names.
I am using C++ language.

please answer.

//