Under construction

Still being built. Things may change

Friends

Time limit1sMemory limit128 MB

Summary
Given which of six friends attend, apply the conditional voting rules, count votes per place, and report the winner or a tie.
Level

Medium4 of 10

Topics
Simulation, Implementation
Solved
No attempts yet

Problem

A group of friends meets at the Hacienda (a rather fine restaurant) every Wednesday to have a few drinks. Sooner or later someone asks the dreaded question: "So, where are we going tonight?" They settle it by voting.

Whom each friend votes for does not depend on their mood — it depends only on who else is present that Wednesday. The rules are:

  1. Anne always votes for the cinema.
  2. Bob votes for the disco if Karin is there too.
  3. Karin votes for the disco if Charly is there; if Charly is not there but Anne is, Karin votes for the cinema; if neither Charly nor Anne is there, Karin votes for the cocktail bar.
  4. Dave never votes for anything.
  5. If Dave is there, Bob votes for the cocktail bar.
  6. If both Charly and Anne are there, both of them vote for the cinema.
  7. Edward votes for the cocktail bar if Anne is there and Charly is not; otherwise Edward votes for the cinema.
  8. If Edward is there, Bob votes for the cocktail bar.
  9. Frank votes for the cinema if neither Bob nor Anne is there, and Frank votes for the disco if Anne is there.
  10. If Anne is not there, Bob votes for the cocktail bar.

For a given Wednesday, count the votes for each place among the friends who are present. If no rule applies to a present friend, or if several rules apply and would make that friend vote for different places, that friend abstains.

Input

The first line contains the number of scenarios (Wednesday meetings).

Each following line describes one scenario: the names of the friends who are present, separated by single spaces. Names consist of letters only, and the same name never appears more than once on a line. A line may list no friends at all, meaning nobody is present.

Output

For each scenario, print a line "Scenario #i:", where i is the scenario number starting at 1. On the next line print the place that received the most votes. The possible places are 'cinema', 'cocktail bar', and 'disco'. If no place received strictly more votes than both of the others, print 'stay at the Hacienda' instead. Separate consecutive scenarios with a single blank line.

Examples2

  1. Example 1

    Input
    2
    Frank Dave
    Karin Frank
    
    Expected output
    Scenario #1:
    cinema
    
    Scenario #2:
    stay at the Hacienda
    
  2. Example 2

    Input
    1
    Anne
    
    Expected output
    Scenario #1:
    cinema