#include<iostream>  
#include<math.h>
#include<iomanip> 
#include <string>
#include<algorithm>
#include <vector>
#include<queue>  
#include<deque>
#include<stack>
#include<map>
#define all(v) v.begin(), v.end()
#define Gareth_Bale ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef double ld;
using namespace std;

int gcd(int a, int b) {
    while (b != 0) {
        int x = a;
        a = b;
        b = x % b;
    }
    return a;
}
int lcm(int a, int b) {
    return (a * b) / gcd(a, b);
}
long long rev_num(long long n) {
    long long rev = 0;
    while (n > 0)
    {
        int digit = n % 10;
        rev = rev * 10 + digit;
        n /= 10;
    }
    return rev;
}
bool isPrime(long long n) {
    if (n <= 1) return false;
    for (int i = 2; i * i <= n; i++)
        if (n % i == 0) return false;
    return true;
}
bool islucky(long long n) {
    while (n > 0) {
        int digit = n % 10;
        if (digit != 4 && digit != 7) {
            return false;
        }
        n /= 10;
    }
    return true;
}
bool preceed(ll x, ll y) {
    return x > y;
}

int main() {
    Gareth_Bale;
    int q; cin >> q; stack<string>st;
    while (q--) {
        string s;cin >> s;
        if (s == "Header" || s == "Row" || s == "Cell" || s == "Table")
            st.push(s);

        else if (!st.empty() && st.top() == "Header" && s == "EndHeader")
            st.pop();

        else if (!st.empty() && st.top() == "Row" && s == "EndRow")
            st.pop();

        else if (!st.empty() && st.top() == "Cell" && s == "EndCell")
            st.pop();

        else if (!st.empty() && st.top() == "Table" && s == "EndTable")
            st.pop();

        else
        {
            cout << "WA";
            return 0;
        }
    }
    cout << "ACC";
    return 0;
}
