#include <bits/stdc++.h>   using namespace std;   string parse(string str) {     string returnme;     for (int i = 0; i < str.length(); i++) {       if (str[i] ==  _  || str[i] ==  ;  || str[i] ==  - ) {       } else {         returnme.push_back(tolower(str[i]));       }     }     return returnme;   }   int main() {     string con1, con2, con3;     cin >> con1 >> con2 >> con3;     con1 = parse(con1);     con2 = parse(con2);     con3 = parse(con3);     int n;     cin >> n;     vector<string> con;     con.push_back(con1 + con2 + con3);     con.push_back(con1 + con3 + con2);     con.push_back(con3 + con2 + con1);     con.push_back(con2 + con3 + con1);     con.push_back(con2 + con1 + con3);     con.push_back(con3 + con1 + con2);     for (int i = 0; i < n; i++) {       string str;       cin >> str;       str = parse(str);       bool acc = false;       for (int j = 0; j < 6; j++) {         if (str == con[j]) {           cout <<  ACC  << endl;           acc = true;           break;         }       }       if (acc == false) {         cout <<  WA  << endl;       }     }     return 0;   }   