Lit E. Gator is a prominent attorney who specializes in bar brawls. In order to maximize his profit, he wants to blame as many people as possible for hitting his client. Thus, he also has to find who was hit the most and by whom. He tries to convince courts that bar brawls are like runaway reactions; the blame should follow the entire chain of who hit whom.Unfortunately (?), Mr. Gator has a very small brain. He loses track of who hit whom very quickly. Being a prominent attorney, he is rich. Being a computer science student, you are poor. There is an opportunity here...
Input will be the number of people involved along with pairs of integers indicating who hit whom. Data will be ended with a pair of zeros.
Incorrect, out of range data may be given and should be acknowledged with a warning and then ignored. The examples are elaborate for explanation's sake. Your program does not need to specify the error so precisely.
Example 2:
Number of people in the scuffle? 3
Who hit whom? 1 3
Who hit whom? 4 2
There are only 3 people involved, person 4 is innocent.
Who hit whom? 2 4
There are only 3 people involved, person 4 is innocent.
Who hit whom? 5 6
There are only 3 people involved, person 5 and person 6 are innocent.
Who hit whom? 3 2
Who hit whom? 0 0
Person 1 was not hit.
Person 2 was hit by person 1 and person 3.
Person 3 was hit by person 1.
Example 4:
Number of people in the scuffle? 5
Who hit whom? 1 2
Who hit whom? 2 3
Who hit whom? 3 4
Who hit whom? 4 2
Who hit whom? 5 4
Who hit whom? 5 3
Who hit whom? 0 0
Person 1 was not hit.
Person 2 was hit by person 1, person 3, person 4, and person 5.
Person 3 was hit by person 1, person 2, person 4, and person 5.
Person 4 was hit by person 1, person 2, person 3, and person 5.
Person 5 was not hit.
Example 5:
Number of people in the scuffle? 3
Who hit whom? -1 3
People are represented by positive integers (and lawyers).
Who hit whom? 2 2
Who hit whom? 1 2
Who hit whom? 3 1
Who hit whom? 4 5
There are only 3 people involved, person 4 and person 5 are innocent.
Who hit whom? 0 0
Person 1 was hit by person 3.
Person 2 was hit by person 1, person 2, and person 3.
Person 3 was not hit.