#include <iostream>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
using namespace std;

int N;
string S[100];

int main(void) {
  cin >> N;
  REP(i, 0, N) cin >> S[i];

  int cnt = 0;
  REP(i, 0, N) {
    if(S[i] == "A") cnt++;
    if(S[i] == "Un") {
      cnt--;
      if(cnt < 0) break;
    }
  }
  cout << (cnt == 0 ? "YES" : "NO") << endl;

  return 0;
}