#include <iostream>
#include <stack>
using namespace std;
int main(void){
	int n;
	int flag=0;
	string s;
	stack<int> st;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> s;
		if(st.empty() && s == "Un"){
			flag = 1;
			break;
		}
		if(s == "A"){
			st.push(1);
		}
		else if(s == "Un"){
			st.pop();
		}		
	}
	if(flag != 1 && st.empty()){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}
	
	return 0;
}
