#include <iostream>
#include <string>
using namespace std;

int main(){
	int n;
	bool flag = true;
	int count = 0;
	string s;
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> s;
		if(s == "A"){
		count++;
		}
		else if(s == "Un"){
		count--;
		}
		if(count < 0)flag = false;
	}
	if(flag && count == 0){
	cout << "YES" <<endl;
	}
	else cout << "NO" <<endl;
	return 0;
}