#include using namespace std; int main(){ int n; cin >> n; string s, t; cin >> s >> t; int p = 0, q = 0, r = 0; for (int i = 0; i < n; i++){ int x = s[i] - 'A'; int y = t[i] - 'A'; if (x > y){ cout << "No" << endl; return 0; } if (x == y) continue; if (x == 0 && y == 1){ p++; } else if (x == 0 && y == 2){ q++; } else if (x == 1 && y == 2){ r++; } else { abort(); } } if (p != r){ cout << "No" << endl; return 0; } if (q >= 1 && r == 0){ cout << "No" << endl; } else { cout << "Yes" << endl; } }