#include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  string k;
  bool judge=true;
  int ca=0,cu=0;

  cin >> n;

  for(int i = 0;i<n;i++)
    {
      cin >> k;
      
      /* if(n%2 == 1)
	{
	  cout << "NO" << endl;
	  break;
	}
      else
      {*/
	  if(k=="A")ca++;
	  if(k=="Un")cu++;

	  if(ca < cu)
	    {
	      judge = false;
	    }
	
    }
  if(ca != cu) judge =false;
  if(judge)
    {
      cout << "YES" << endl;
    }
  else
    {
      cout << "NO" << endl;
    }
}

