# Judging Filling Problems

Time Limit: 2000 ms

Memory Limit: 65536 ms

## Description

Yiyi is trying to develop an examine system. He finds it not so easy to judge filling question. There may be multiple answers for a blank, For example, The 2008 Olympic games was hold in ____City，The answer can be “Beijing”, and it can also be “Peking”, he made the answer like this: Beijing(Peking), which means that Beijing, Peking are both correct answers; A filling question may have several blanks, For some problems those blanks should be answered in order, for example, The 2000, 2004 Olympic games was hold respectively in ____City and ____City, The answer should be “Sydney Athens”; For other problems those blanks don’t need be answered in order, for example, ACRush has taken part in the ICPC world finals in the year ____ and ____, The answer could be “2007|2009”, and it can also be “2009|2007”. Now you are required to help him to write a program to judge the filling problems.

## Input

The first line contains an integer N, indicate the number of problems. The following N*3 lines, each 3 lines indicate a filling problem, the first line is the question, the second line is the answer(There will not be a answer contains ‘|’, ’(‘, ’)’ for every blank, For one problem every neighboring blanks are separated by “|” ), the third line indicate if the blanks should be filled in order, the word “True” means the blanks should be filled in order while “False” means that filling the blanks in order is not necessary. The following line contains an integer M, indicate the number of person, each person will fill all the problems, so there follows N*M lines, each N lines indicate a person’s answer for the N problems (There will not be a answer contains ‘|’, ‘(’, ‘)’ for every blank, For one problem every neighboring blanks are separated by “|” ), according to the sequence of the N problems.

## Output

There are M lines, for each person, write the number of blanks he/she filled correctly.

## Sample Input

3
The 2004, 2008 Olympic games was hold respectively in ____City and ____City.
Athens|Beijing(Peking)
True
ACRush has taken part in the ICPC world finals in the year ____ and ____.
2007|2009
False
Aaaa____bbbb_____.
Ccc(cc)|Ddd(dd)
False
2
Athens|Beijing
2007|2009
Dd|cc
Beijing|Athens
2009|2008
Ddd|cc


## Sample Output

5
3

## Source

3rd Central South China Programming Contest