#include using namespace std; using ll=long long; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin>>N; string S,T; cin>>S>>T; int AC=0,AB=0,BC=0; for(int i=0;iT[i]){ cout<<"No\n"; return 0; } if(S[i]!=T[i]){ if(S[i]=='A'&&T[i]=='C'){ AC+=1; }else if(S[i]=='A'&&T[i]=='B'){ AB+=1; }else if(S[i]=='B'&&T[i]=='C'){ BC+=1; } } } if(AB!=BC||BC==0&&AC!=0){ cout<<"No\n"; }else{ cout<<"Yes\n"; } }