Dom Cobb and his partner Arthur perform illegal stuffs by entering the subconscious minds of their targets. They use two-level dream within a dream strategy to extract valuable information. Dreamers are awakened either by a sudden shock (a "kick"), or they may die in the dream.
Now Dom wants your help. Because he has a complex assignment. He has to go through a lot of people's dreams. He travels from one person's dream to another person's dream. He is too consumed that he can no longer keep track whether he is awake or in someone else's dream.
He will give you n queries to process, each of the queries will be in one of the following forms:
First line will contain an integer n (1 ≤ n ≤ 10000), the number of queries. Each of the following n lines will contain one of the three queries mentioned above. For the case of 'Sleep X' query, X will be a string composed of only uppercase or lowercase letters and no more than 15 characters long.
For each of the 'Test' queries, print the name of the person whose dream Dom is in right now exactly as it appeared in the input. If Dom is in no one's dream, output the line 'Not in a dream'. Check sample input and output for details.
範例輸入 1
20 Sleep Dom Sleep Sakin Test Sleep Asif Sleep Mushfiq Test Kick Test Sleep Shafi Test Kick Test Kick Test Kick Test Kick Test Kick Test
範例輸出 1
Sakin Mushfiq Asif Shafi Asif Sakin Dom Not in a dream Not in a dream
Pro 專屬功能: 查看這題在歷屆 CPE 出現過幾次 — 升級以解鎖.