Codeforces Beta Round 57 (Div. 2)
B
Hard Work
Codeforces
1300
原题
← AC →
翻译中…

After the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer!

翻译中…

Some days before the contest, the teacher took a very simple-looking exam and all his $*n*$ students took part in the exam. The teacher gave them $3$ strings and asked them to concatenate them. Concatenating strings means to put them in some arbitrary order one after the other. For example from concatenating Alireza and Amir we can get to AlirezaAmir or AmirAlireza depending on the order of concatenation.

翻译中…

Unfortunately enough, the teacher forgot to ask students to concatenate their strings in a pre-defined order so each student did it the way he/she liked.

翻译中…

Now the teacher knows that Shapur is such a fast-calculating genius boy and asks him to correct the students' papers.

翻译中…

Shapur is not good at doing such a time-taking task. He rather likes to finish up with it as soon as possible and take his time to solve 3-SAT in polynomial time. Moreover, the teacher has given some advice that Shapur has to follow. Here's what the teacher said:

翻译中…
  • As I expect you know, the strings I gave to my students (including you) contained only lowercase and uppercase Persian Mikhi-Script letters. These letters are too much like Latin letters, so to make your task much harder I converted all the initial strings and all of the students' answers to Latin.
  • As latin alphabet has much less characters than Mikhi-Script, I added three odd-looking characters to the answers, these include "-", ";" and "_". These characters are my own invention of course! And I call them Signs.
  • The length of all initial strings was less than or equal to $100$ and the lengths of my students' answers are less than or equal to $600$
  • My son, not all students are genius as you are. It is quite possible that they make minor mistakes changing case of some characters. For example they may write ALiReZaAmIR instead of AlirezaAmir. Don't be picky and ignore these mistakes.
  • Those signs which I previously talked to you about are not important. You can ignore them, since many students are in the mood for adding extra signs or forgetting about a sign. So something like Iran;;-- is the same as --;IRAN
  • You should indicate for any of my students if his answer was right or wrong. Do this by writing "WA" for Wrong answer or "ACC" for a correct answer.
  • I should remind you that none of the strings (initial strings or answers) are empty.
  • Finally, do these as soon as possible. You have less than $2$ hours to complete this.
翻译中…

Input

翻译中…

The first three lines contain a string each. These are the initial strings. They consists only of lowercase and uppercase Latin letters and signs ("-", ";" and "_"). All the initial strings have length from 1 to 100, inclusively.

翻译中…

In the fourth line there is a single integer $*n*$ ($0 ≤ *n* ≤ 1000$), the number of students.

翻译中…

Next $*n*$ lines contain a student's answer each. It is guaranteed that the answer meets what the teacher said. Each answer iconsists only of lowercase and uppercase Latin letters and signs ("-", ";" and "_"). Length is from 1 to 600, inclusively.

翻译中…

Output

翻译中…

For each student write in a different line. Print "WA" if his answer is wrong or "ACC" if his answer is OK.

翻译中…

样例

Input #1
Iran_
Persian;
W_o;n;d;e;r;f;u;l;
7
WonderfulPersianIran
wonderful_PersIAN_IRAN;;_
WONDERFUL___IRAN__PERSIAN__;;
Ira__Persiann__Wonderful
Wonder;;fulPersian___;I;r;a;n;
__________IranPersianWonderful__________
PersianIran_is_Wonderful
Output #1
ACC
ACC
ACC
WA
ACC
ACC
WA
InputCopy OutputCopy
Input #2
Shapur;;
is___
a_genius
3
Shapur__a_is___geniUs
is___shapur___a__Genius;
Shapur;;is;;a;;geni;;us;;
Output #2
WA
ACC
ACC
InputCopy OutputCopy
题目信息
题号
61B
时间限制
2 s
内存限制
256 MB
标签
字符串

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。