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

string s[101];

int main(){
	int n;
	cin >> n;
	for(int i=0; i<n; i++) cin >> s[i];
	
	int a = 0;
	int flag = 1;
	for(int i=0; i<n; i++){
		if(s[i] == "A") a += 1;
		else if(s[i] == "Un")a -=1 ;
		
		if(a < 0) flag = 0;
	}
	if(a != 0) flag = 0;
	
	if(flag) cout << "YES" << endl;
	else cout << "NO" << endl;
	
	return 0;
}
