407219: GYM102697 190 Contact Tracing
Description
During the coronavirus pandemic, your town is attempting to trace the origins of recent COVID-19 cases.
You're given a list of people who had the disease, and who they got it from, and you're trying to find the names of "superspreaders". For this problem, we'll define a superspreader as someone who gave at least three other people COVID-19.
Given this information, your task is to figure out the names of all of the superspreaders in the town.
InputThe first line of input contains a single positive integer $$$n$$$: the number of people in the town.
The next $$$n$$$ lines contain two space-separated strings: the name of each person, and the name of the person they got the coronavirus from. Exactly one person in the town will have "OTHER" (no quotes) as the person they got the disease from, indicating that this person got the disease from a different town.
OutputOutput $$$k$$$ lines, where $$$k$$$ is the number of superspreaders in the town. On each line, print the name of each superspreader in the order they were given in the input.
If there aren't any superspreaders in the town, output "NONE" (no quotes).
ExamplesInput10 Alice OTHER Bob Alice Cheryl Alice Darryl Bob Ernie Alice Frank Darryl Greta Darryl Hank Cheryl Irene Bob John DarrylOutput
Alice DarrylInput
4 Keith OTHER Larry Keith Marshall Larry Nancy MarshallOutput
NONEInput
6 Alice Frank Bob Ernie Cheryl Darryl Darryl Ernie Ernie OTHER Frank ErnieOutput
Ernie