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

int main(){
	int N, a = 0, ans = 0;
	string S;
	cin>>N;
	for(int i = 0; i < N; i++){
		cin>>S;
		if(S == "A") {
			a++;
		}
		if(S == "Un"){
			if(a - 1 < 0){
				ans = 1;
			}
			a--;
		}
	}
	
		
	if(ans || a != 0) cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
	return 0;
}

