Description

Misfits Academy has introduced therapy sessions for their troubled teenagers. One of the
activities is designed to help the teens be nice to each other. It works like this:
The people sit in a circle, and each writes their own name on the top of
a piece of paper. Each person then passes the paper to their left. Once a
person has been passed a piece of paper, they have to write a nice, affirming
comment about the person whose name is at the top; ¡®You are a wonderful
person¡¯, ¡®Thank you for being so helpful¡¯¡ªsomething like that. The comment
is written at the bottom of the paper which is then folded up so that the
comment is hidden. The paper is then passed to the left again and the process
repeated. It stops when each person has back the paper they started with, at
which point they unfold the paper and read all the nice things the others have
written.
That is the idea. However, sometimes some participants misunderstand and
think they can write anything they like! Although many of their comments
are nice, sometimes they write unpleasant things such as ¡®You talk too much¡¯,
or ¡®Your clothes are scruffy¡¯. Of course, if you receive your paper back and
it has something unpleasant written on it, you can quite easily tell who was
unkind to you!
That is what you have to do in this problem.

Input

The input represents a number of groups,
each starting with a line containing a single integer, n, representing the number of people
in the group (5 <= n <= 20). There then follow n lines, each line containing the contents of
one piece of paper. The lines each begin with the name of one person in the group; the
lines are in the same order as the people were sitting, with the papers being passed from
one person to the one named on the following line. The last named person passed to the
first named person.
Following the name of the person are the messages as they appear on the paper from top
to bottom (which is, of course, opposite to the order in which the comments were written).
To keep things simple, the messages have been read and summarised. A pleasant message
has been represented as ¡®P¡¯, a nasty message as ¡®N¡¯. The letters are separated by single
spaces.
A line containing only ¡®0¡¯, in place of an integer n representing the number of people in
the group, indicates the end of input.

Output

Output for each group will start with a line ¡®Group g¡¯ stating the group number, starting
with 1. Then for each nasty message, one line of output of the form ¡®A was nasty
about B¡¯ must be given. Where there is more than one nasty message, they must be
listed in the order they appear in the input: first those from the first piece of paper, from
left to right, then the next piece of paper, from left to right, and so on. If all the messages
written by the group are pleasant, the output must state ¡®Nobody was nasty¡¯.
A blank line is to be left between groups.

Sample Input

5
Ann P N P P
Bob P P P P
Clive P P P P
Debby P N P P
Eunice P P P P
6
Zheng P P P P P
Yeng P P P P P
Xiao P P P P P
Will P P P P P
Veronica P P P P P
Utah P P P P P
0

Sample Output

Group 1
Debby was nasty about Ann
Bob was nasty about Debby
Group 2
Nobody was nasty

Source

New Zealand Programming Contest 2006