Anybody who has been to a child's birthday has seen the following scenario:
The input may contain several test cases. The first line of each test case is an integer N, the number of requests that must be satisfied. Following this line are the N requests, each on its own line. Each request has one of these formats:
<person> wants <drink> <person> hates <drink> <person> wants same as <person> <person> wants different from <person> <person> wants <drink> if <person> gets <drink><person> is the name of a person - up to 20 lower-case letters. <drink> is either Coke or chocolate milk.
If it is possible to make everybody happy, print one line per person,
in alphabetical order, with the format
<person> gets <drink>Be sure to correctly capitalize the drinks (Coke, chocolate milk).
If there is more than one way to make everybody happy (fat chance!), fill their glasses in alphabetical order and pour Coke (it's cheaper) whenever there is a choice. If it is not possible to make everybody happy, print
Everybody gets waterOutput a blank line after each test case. The input ends with 0 for the value of N.
4 jamie wants Coke john hates Coke mary wants same as john barry wants different from mary 0
barry gets Coke jamie gets Coke john gets chocolate milk mary gets chocolate milk