#include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, ab = 0; string s, t; cin >> n >> s >> t; for(int i = 0; i < n; i++){ if(s[i] > t[i]){ cout << "No\n"; return 0; } if(s[i] == t[i]) continue; if(t[i] == 'C'){ if(ab == 0){ cout << "No\n"; return 0; } if(s[i] == 'B') ab--; }else{ ab++; } } cout << (ab == 0 ? "Yes" : "No") << '\n'; }