#P5601. 小 D 与笔试
小 D 与笔试
Background
Xiao D is an IO contestant who is about to take ION. However, the large number of strange problems in the written test question bank gives him a headache. Please help him.
Problem Description
The written test question bank can be abstracted as problems. Each problem consists of a statement and an answer, both of which are strings. It is guaranteed that all problem statements are distinct.
To check how well Xiao D has memorized the written test materials, the coach held a mock exam. The exam contains problems. Each problem has options, and Xiao D needs to choose the option that matches the answer among the options.
Now you need to help Xiao D finish this exam.
Input Format
The first line contains two positive integers .
The next lines each contain strings separated by spaces, representing the problem statement and the answer for that problem.
The next lines each contain strings separated by spaces. The first string is the problem statement in the mock exam. The remaining strings, in order, are options A through D for this problem. It is guaranteed that all options are distinct.
Output Format
For each problem in the mock exam, output a single character indicating which option corresponds to the correct answer. It is guaranteed that every problem has a solution.
3 4
decoak yes
duliuchutiren nonono
csps noiptg
decoak yes no qwq qaq
csps noiptg noippj noi cspj
decoak qwq qaq yesyes yes
duliuchutiren yes no nono nonono
A
A
D
D
Hint
Constraints
Let be the maximum string length in the input.
For of the testdata, .
For another of the testdata, .
For of the testdata, , and all strings consist of lowercase Latin letters.
Translated by ChatGPT 5