**This is a normal judge problem.**
"Diamond Eyes" is a song by American alternative metal band Deftones. The lyrics are about two separate soulmates will eventually be together again.
Time will see us realign
Diamonds rain across the sky
Shower me into the same realm
Soulmates often have parallel lives and have uncanny similarities. In this problem you need to find out how parallel these two people's lives are.
Different events happen at differnet times in people's lives. Based on the emotions, we classify these events into 4 categories: Happy, Sad, Angry, and Fearful. We can further draw a diagram to visualize the timeline, for example:
Suppose there are two people that might not be the same age. We define a "matching age", which is the age that the two people have experienced exactly same number of events for all the four emotions. In other words, if two people have same sums of events from age 0 to a certain age, that certain age is a matching age. Check the sample input visualization in the Input section. The age 2 is a matching age since both people have experienced 1 Angry, 1 Fearful, and 1 Happy event, while the age 3 is not a matching age.
We can find out two people’s degree of parallel by looking at the number of the matching ages. Given the event information of the two people, print the total number of matching ages and what the exact ages are.
The input consists of two parts, representing two people's lives separately.
For each part:
The first line contains two integers a and n, representing the age of the person and the total number of events happened before.
The following n lines represent n events separately. Each line consists of an integer t and a string e. t represents the age at when the event happened. e indicates the type of the emotion and will be one from the set {"Angry", "Fearful", "Happy", "Sad"}.
Note: The events won't be given in order of age.
It's guaranteed that:
Sample input visualization:
In the first line, print the total number of matching ages followed by a newline symbol.
In the next line, print the exact matching ages in ascending order. Separate each number with a space and print a newline symbol in the end.
Note: If there's not any matching age. You only need to print the first line with a 0 and a newline symbol. (Don't need to print the second line)