#include using namespace std; #define int long long #define app push_back #define all(x) (x).begin(),(x).end() #ifdef LOCAL #define debug(...) [](auto...a){ ((cout << a << ' '), ...) << endl;}(#__VA_ARGS__, ":", __VA_ARGS__) #else #define debug(...) #endif #ifdef LOCAL #define __int128 long long #endif // LOCAL const int inf=1e18; int32_t main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); int n;cin>>n; string s,t;cin>>s>>t; for(int i=n-2;i>=0;--i) { if(s[i]=='A' && t[i+1]=='C' && s[i+1]=='B') { s[i]++;s[i+1]++; } } cout<<(s==t ? "Yes" : "No"); return 0; }