The drizzle that fell last week made Professor Claudius Virux get homesick of his time as a student of UFCG at Campina Grande - Pb . There, the winter is a period marked by little rains (same as those at Joinville), with cold nights.
At the university, the students's parties, occurring in almost every Fridays and Saturdays, were big deals. The most interesting is that there were present the most unusual people, poets, singers, teachers, and other artists as well, and of course the students. There was always a reason to make a party, if there wasn't , the reason was to celebrate the tough week at the university.
The most curious was the system of how the host invited his friends. The owner of the house invited his immediate friends, who also invited others, and so on. On the day of the party, the host wanted to know his/her new friends in order to see how the chain of invitation had propagated.
To control the number and how the guests came to the party, the host asked everyone who arrived, to write his/her name, and the name of whom had invited him/her.
Your task is to count how many guests are present at each party, given only the immediate relationship between a guest and a friend.
For each party there will be a number of relationships between the guests. This is a value N written before the relationships, which follows in pairs of type (x, y) = (y, x). Where x is the name of a friend and y is his guest. The values of x and y are numbered from 1 to 1000, and the host number is always 1.
When N is equal to 0, this indicates the end of the party! The format of the input follow the standards below.
For each set of relationships, print the total number of participants at the party, including the host. The total of each party per line. On input 0 don't print anything.
|Sample Input||Sample Output|