Abstract Communication Mastership (ACM) is a software company that runs a social network called tWinter.
Every tWinter user has a handle that starts with a commercial at sign (@). Users publish short messages to the network.
A message mentions a handle when the handle appears in the message as one space delimited word, that is, when it is preceded by a space or starts the message, and followed by a space or ends the message. Only the handle of a user other than the author counts as a mention, so a message that repeats its own author's handle mentions nobody by that handle.
A sequence of messages is a conversation when every message in it, except the first, mentions the author of the previous message of the sequence. The messages of a conversation keep the chronological order of the log.
Given a chronological log of messages, find the longest conversation.
The first line contains an integer n (1≤n≤50000), the number of messages in the log.
Each of the next n lines contains one message, preceded by the handle of its author, a colon (:), and a space.
Each message is at most 139 characters long. Each handle is at most 20 characters long and contains no colon and no space.
The input contains only characters with ASCII codes 32 to 126 inclusive, and line breaks.
On the first line print the length of the longest conversation.
On the second line print the 1-based indices of the messages of that conversation in increasing order, separated by single spaces.
Several conversations can reach the maximum length. Print the one whose sequence of indices is lexicographically smallest: the first index is as small as possible, among the sequences with that first index the second index is as small as possible, and so on.