Problems
Beverages
Beverages
Dilbert has just finished college and decided to go out with friends. Dilbert has some strange habits and thus he decided to celebrate this important moment of his life drinking a lot. He will start drinking beverages with low alcohol content, like beer, and then will move to a beverage that contains more alcohol, like wine, until there are no more available beverages. Once Dilbert starts to drink wine he will not drink beer again, so the alcohol content of the beverages never decreases with the time.
You should help Dilbert by indicating an order in which he can drink the beverages in the way he wishes.
\InputFile
Each test case starts with $n \:(1 \le n \le 100)$, the number of available beverages. Then will follow $n$ lines, informing the name of each beverage, a name has less than $51$ characters and has no white spaces. Then there is another line with an integer $m,\:(0 \le m \le 200)$ and $m$ lines in the form $b_1 \space b_2$ will follow, indicating that beverage $b_2$ has more alcohol that beverage $b_1$, so Dilbert should drink beverage $b_1$ before he starts drinking beverage $b_2$. Be sure that this relation is transitive, so if there is also a relation $b_2 \space b_3$ you should drink $b_1$ before you can drink $b_3$. There is a blank line after each test case. In the case there is no relation between two beverages Dilbert should start drinking the one that appears first in the input. The input is terminated by end of file (EOF).
\OutputFile
For each test case you must print the message: \texttt{"Case #C: Dilbert should drink beverages in this order:} $b_1 \space b_2 \space ... \space b_n$\texttt{."}, where $C$ is the number of the test case, starting from $1$, and $b_1 \space b_2 \space ... \space b_n$ is a list of the beverages such that the alcohol content of beverage $b_{i}$ is not less than the alcohol content of beverage $b_{i−1}$. After each test case you must print a blank line.
Input example #1
3 vodka wine beer 2 wine vodka beer wine 5 wine beer rum apple-juice cachaca 6 beer cachaca apple-juice beer apple-juice rum beer rum beer wine wine cachaca 10 cachaca rum apple-juice tequila whiskey wine vodka beer martini gin 11 beer whiskey apple-juice gin rum cachaca vodka tequila apple-juice martini rum gin wine whiskey apple-juice beer beer rum wine vodka beer tequila
Output example #1
Case #1: Dilbert should drink beverages in this order: beer wine vodka. Case #2: Dilbert should drink beverages in this order: apple-juice beer wine rum cachaca. Case #3: Dilbert should drink beverages in this order: apple-juice wine vodka beer rum cachaca tequila whiskey martini gin.