P1580 yyy loves Easter_Egg I

Background

Soha’s problem-setting efficiency is truly astonishing. The OI, math, and chemistry problems are all ready, but not a single physics problem. So, Huntfire, absi2011, and redbag take turns bombing soha, planning to keep bombing until soha shows up. Unexpectedly, kkksc03 rushes out from the crowd...

Description

![](https://cdn.luogu.com.cn/upload/pic/1456.png) ![](https://cdn.luogu.com.cn/upload/pic/1455.png) yyy loves OI (Huntfire), yyy loves Maths (redbag), and yyy loves Chemistry (absi2011) take turns bombing yyy loves Physics (soha), in the order Huntfire, redbag, absi2011. In this problem, we do not consider complicated queue shapes. We consider the queue shape to be maintained if and only if a line contains exactly one @, and the person being @-mentioned is the same as in the previous line. For example, the following are also considered to maintain the queue shape: - `yyy loves OI : @yyy loves Microelectronic` - `yyy loves Maths : @yyy loves Microelectronic 我佩服soha的出题效率` - `yyy loves OI : @yyy loves Microelectronic +1` - `yyy loves Chemistry : +1 @yyy loves Microelectronic` If the person being @-mentioned is different from the one in the first line, the queue shape is considered broken. If the bombed person appears to speak before the queue shape is broken, or they are the one who breaks the queue shape, the frying is considered successful. If the frying is successful, output `Successful @someone attempt`. If the queue shape is broken first, output `Unsuccessful @someone attempt`, then output the line number where the queue shape is first broken, and the $\text{id}$ of the person who first broke the queue shape. If the queue shape is never broken, first output `Unsuccessful @someone attempt`, then output the length of the queue shape, and finally output `Good Queue Shape`. ~~p.s.yyy loves Microelectronic 是 kkksc03~~

Input Format

$N$ lines of message logs after the bombing starts, one message per line. Message format: “sender + `:` + content”. Each line’s length does not exceed $1000$. (Chinese is replaced by pinyin.)

Output Format

If the frying is successful, output `Successful @someone attempt`. If the queue shape is broken first, output three lines: - First line: `Unsuccessful @someone attempt`. - Second line: the line number where the queue shape is first broken. - Third line: the $\text{id}$ of the person who first broke the queue shape. If the queue shape is never broken, output three lines: - First line: `Unsuccessful @someone attempt`. - Second line: the length of the queue shape. - Third line: `Good Queue Shape`.

Explanation/Hint

**@yyy loves Physics 我佩服你的出题效率** This problem merely pokes fun at soha and commemorates the author’s queue shape, which lasted $91$ lines. For $100\%$ of the testdata, each line length $\le 10^3$. - The number of lines does not exceed $5\times 10^4$. - The input file size does not exceed $4\text{MB}$. - The first speaker is guaranteed to @ someone. - Everyone’s name is guaranteed to follow the format $\text{yyy loves ***}$. - It is guaranteed that nobody’s message contains `:`. - The first speaker is guaranteed to @ exactly one person. - The first speaker is guaranteed not to @ themselves. - There is guaranteed to be an empty line at the end of the file to help you detect EOF. - It is not guaranteed how many people later speakers will @; however, if the number is not exactly one, it is considered breaking the queue shape. - It is not guaranteed whether later speakers will repeatedly @ the same person. - It is not guaranteed that the bombed person will break the queue shape. - It is not guaranteed whether this problem is or is not the final problem. - It is not guaranteed that this contest set even has a final problem. - It is not guaranteed that the next contest set will be as easy as this one. - It is not guaranteed that there are no others in the group besides these $4$ people and kkksc03. - It is not guaranteed that mocking soha without ACing this problem won’t cause trouble. - If you AC it, you may mock soha once; soha won’t mind. Translated by ChatGPT 5