#include using namespace std; using ll = long long; using i64 = long long; #define var auto int main() { cin.tie(0)->sync_with_stdio(false); int n; string s, t; cin >> n >> s >> t; int a = 0; int b = 0; int c = 0; for (int i = 0; i < n; i++) { if (s[i] == t[i]) continue; if (s[i] == 'A' && t[i] == 'B') a++; else if (s[i] == 'B' && t[i] == 'C') b++; else if (s[i] == 'A' && t[i] == 'C') c++; else { cout << "No" << endl; return 0; } } if (c > 0 && b == 0) { cout << "No" << endl; return 0; } if (a != b) { cout << "No" << endl; return 0; } cout << "Yes" << endl; }