#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;

int main() {
    int n;
    cin >> n;

    int a=0, u=0;
    rep(i, n) {
        string t;
        cin >> t;

        if (t == "A") a++;
        if (t == "Un") u++;

        if (a < u) {
            cout << "NO" << endl;
            return 0;
        }

    }

    cout << (a == u ? "YES" : "NO") << endl;

}