#include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, ab = 0, bc = 0, S = 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'){ S |= 1; bc++; if(s[i] == 'A') ab++; }else{ S |= 2; ab++; } } cout << (ab == bc && (ab == 0 || (ab >= 1 && S >= 3)) ? "Yes" : "No") << '\n'; }