#P2580. 于是他错误的点名开始了

于是他错误的点名开始了

Description

After that, the principal appointed you as a special agent to record his roll calls every day. The principal will provide the number of chemistry competition students and the roster, and you need to tell the principal whether he called the names correctly. (Why not just stop him from playing Hearthstone.)

Input Format

The first line contains an integer nn, the number of students in the class.
The next nn lines each contain a string representing a name (all distinct, lowercase letters only, length no more than 5050).
The (n+2)(n+2)-th line contains an integer mm, the number of names the coach called.
The next mm lines each contain a string representing a name called by the coach (lowercase letters only, length no more than 5050).

Output Format

For each name called by the coach, output one line.
If the name is correct and appears for the first time, output OK. If the name is incorrect, output WRONG. If the name is correct but not the first time, output REPEAT.

5  
a
b
c
ad
acd
3
a
a
e

OK
REPEAT
WRONG

Hint

  • For 40%40\% of the testdata, n1000n \le 1000, m2000m \le 2000.
  • For 70%70\% of the testdata, n104n \le 10^4, m2×104m \le 2 \times 10^4.
  • For 100%100\% of the testdata, n104n \le 10^4, m105m \le 10^5.

upd 2022.7.30\text{upd 2022.7.30}: A new set of Hack testdata was added.

Translated by ChatGPT 5