F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Firebirds' Logic Nation

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 85    Accepted Submission(s): 5


Problem Description
In HDU, there is an little world created by GL, WYB, and CTW. This world lives some birds which are recognized as firebirds. Actually, the firebirds' world exists three kind of birds, respectively created by GL, WYB, CTW. So I will call them "Gbird", "Wbird", "Cbird" below.
What's more, these birds can talk to ACMers and have their own habit as follows:
Gbird are like GL, never tell truth. Wbird like to tell the truth in the day, but lie in the night. While Cbird are all honest, and never lie.
Now, some firebirds talk to you and tell you some statements, can you deduce what kind of these birds are, and whether it's day or night?
 

Input
The input contains several cases. Each description starts with two integer n and m respectively represent the number of birds and statements. Then following m lines each contain one statement. And one statement is begin with "X: ", X is the identity of speaker. Then follows the contents, like following kinds:

I am [not] ( Gbird | Wbird | Cbird | lying ).
X is [not] ( Gbird | Wbird | Cbird | lying ).
It is ( day | night ).

The word in [] may appear or not appear. The word in () mean that exactly one of the words separated by | must appear. X is the identity of birds, it's a uppecase character between 'A' and 'Z'.
0 < n < 27, 0 < m < 100, 'A' <= X <= 'Z'.
Input end with a case n = 0 and m = 0.
 

Output
For each case, first output a line with "Case #x:", x represent the number of case and start with 1. Then print "You're kidding.", if the conversation cannot happen according to the rules or "I messed up.", if no facts can be deduced. Otherwise print all the facts that can be deduced.
 

Sample Input
1 1 A: I am Cbird. 1 1 A: I am lying. 3 4 A: B is Wbird. B: C is Wbird. C: A is Wbird. C: I am Gbird. 0 0
 

Sample Output
Case #1: I messed up. Case #2: You're kidding. Case #3: A is a Gbird. B is a Cbird. C is a Wbird. It is night.
 

Hint
hints£º
case 1: You cannot reduce anything from it.
case 2: If A is lying, then it's telling a truth. If it's telling a truth, it's lying. So it cannot happen according to the rules.
case 3: Gbird won't say itself is a Gbird, so C is lying(statement 4 is false). You can reduce that it is night and C is a Wbird.
So B is telling the truth(statement 2 is true).
It's a Cbird. A is not a Wbird(statement 3 is false) and is not a Cbird(statement 1 is false). So A is a Wbird.
 

Author
CTW
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 18:04:18, Gzip enabled