#include using namespace std; using ll = long long; int N; string S, T; int ord[201010]; int main(void){ ios::sync_with_stdio(false); cin.tie(nullptr); cin >> N >> S >> T; bool f = true; for(int i = 0;i < N;i++){ f &= (S[i] <= T[i]); } int ab = 0, ac = 0, bc = 0; for(int i = 0;i < N;i++){ if(S[i] == 'A' && T[i] == 'B')ab++; if(S[i] == 'A' && T[i] == 'C')ac++; if(S[i] == 'B' && T[i] == 'C')bc++; } f &= ab == bc && ab > 0; cout << (f ? "Yes\n" : "No\n"); return 0; }