Password

No attempts yetTime limit1sMemory limit256 MB

Problem

An internet banking site runs one more check after the password. Each customer registers several security questions together with their answers. At login the site shows one of those questions and the outline of the stored answer. Every character of the answer gets a box, and exactly two boxes are left empty. The customer presses the letters that belong in the two empty boxes, from left to right.

In the picture the answer has seven letters and the fifth and seventh boxes are empty. If the stored answer is WHISPER, the customer presses P and then R.

Check the letters a customer pressed against the stored answer.

When positions in an answer are numbered, only letters are numbered, starting at 1. Spaces are skipped.

Input

The first line contains the number of customers CC (0<C500 < C \le 50).

The data for each customer begins with a line holding the number of stored security answers AA (2<A<102 < A < 10). The next AA lines hold the answers, one per line. An answer contains upper case letters and spaces only and is 5 to 32 characters long. The first of those lines is the answer to security question 1, the next one is the answer to question 2, and so on.

The next line holds the number of login attempts to process, LL (0<L500 < L \le 50). Each of the next LL lines describes one attempt as three positive integers followed by two upper case letters, all separated by single spaces. The first integer is the number of the security answer used. The second and third integers are the positions of the two empty boxes, given in ascending order. Positions count letters only, starting at 1, and skip spaces. The last two upper case letters are what the customer pressed into the two boxes, in the order pressed.

All three integers are valid. Each one is at least 1 and at most the largest value possible in its place.

Output

For each customer, first print Customer N on its own line. NN is 1 for the first customer in the input, 2 for the second, and so on.

Then print one line for each login attempt of that customer. Print correct if both pressed letters equal the letters at the required positions of the required answer, in the same order, and error if either letter differs.