# Statistical Trouble

Time Limit: 1000MS

Memory Limit: 10000K

## Input

The input consists of 3 sections: survey description, survey results, and cross table descriptions. The first line of the input contains the name of the survey, which is at most 100 characters long. Subsequent lines describe all the questions in the survey. On the first line of every question there is a 3-character question code (capital letters and digits only) followed by a space, and followed by the question name, which is at most 80 characters long. Each subsequent line for a question describes one possible answer on the question and starts with a space, followed by a single-character code for the answer (capital letter, digit, or character '.', '*', or '@'), followed by a space and followed by an answer description, which is at most 40 characters long. The list of questions is terminated by the line with a single character '#'. All answer codes are unique within the question, and all question codes are unique within the input file. There are at least 2 and at most 10 possible answers per question and at least 2 and at most 100 questions. Next lines in the input file describe survey results. Every line contains a character per question (in the order they appear in the input file) that gives the answer code for the corresponding question. The characters follow one another without any delimiters. This section is terminated by the line with a single character '#'. There is at least one line with answers in the section and at most 10000 answers in total (the number of lines times the number of questions). Next lines in the input describe cross tables that are to be created. Each cross table description occupies one line. That line contains the code for the first question, followed by a space, followed by the different code for the second question, followed by a space, and followed by the cross table name, which is at most 100 characters long. This section is terminated by the line with a single character '#'. There are at most 100 cross table descriptions in the input file. The input has no trailing spaces on any line. All names do not start or end with a space, but may contain spaces.

## Sample Input

New Year Phone Survey for ACM ICPC
Q01 Hello!
H Hello!
Y Yes!
* Uhm...
. (silence)
@ (other)
Q02 How are you?
H Hello!
Y Yes!
F Fine!
Q Who are you?
@ (other)
BYE Happy New Year!
Y You too.
* (censored)
@ (other)
. (hang up)
#
.@.
HH@
.@.
YFY
HQ*
H@.
YYY
.H@
HFY
HH@
#
Q01 Q02 Health vs greeting style
Q02 BYE Politeness matrix
#


## Sample Output

New Year Phone Survey for ACM ICPC - Health vs greeting style
Q01 Hello!
H Hello!
Y Yes!
* Uhm...
. (silence)
@ (other)
Q02 How are you?
H Hello!
Y Yes!
F Fine!
Q Who are you?
@ (other)

Q02:H Q02:Y Q02:F Q02:Q Q02:@ TOTAL
Q01:H     2     0     1     1     1     5
40%    0%   20%   20%   20%  100%
66%    0%   50%  100%   33%   50%
Q01:Y     0     1     1     0     0     2
0%   50%   50%    0%    0%  100%
0%  100%   50%    0%    0%   20%
Q01:*     0     0     0     0     0     0
-     -     -     -     -     -
0%    0%    0%    0%    0%    0%
Q01:.     1     0     0     0     2     3
33%    0%    0%    0%   67%  100%
34%    0%    0%    0%   67%   30%
Q01:@     0     0     0     0     0     0
-     -     -     -     -     -
0%    0%    0%    0%    0%    0%
TOTAL     3     1     2     1     3    10
30%   10%   20%   10%   30%  100%
100%  100%  100%  100%  100%  100%

New Year Phone Survey for ACM ICPC - Politeness matrix
Q02 How are you?
H Hello!
Y Yes!
F Fine!
Q Who are you?
@ (other)
BYE Happy New Year!
Y You too.
* (censored)
@ (other)
. (hang up)

BYE:Y BYE:* BYE:@ BYE:. TOTAL
Q02:H     0     0     3     0     3
0%    0%  100%    0%  100%
0%    0%  100%    0%   30%
Q02:Y     1     0     0     0     1
100%    0%    0%    0%  100%
33%    0%    0%    0%   10%
Q02:F     2     0     0     0     2
100%    0%    0%    0%  100%
67%    0%    0%    0%   20%
Q02:Q     0     1     0     0     1
0%  100%    0%    0%  100%
0%  100%    0%    0%   10%
Q02:@     0     0     0     3     3
0%    0%    0%  100%  100%
0%    0%    0%  100%   30%
TOTAL     3     1     3     3    10
30%   10%   30%   30%  100%
100%  100%  100%  100%  100%


## Source

Northeastern Europe 2001