def can_transform(S, T): for i in range(len(S)): while S[i] != T[i]: if S[i] > T[i]: return "No" S = list(S) if S[i] == 'A': S[i] = 'B' elif S[i] == 'B': S[i] = 'C' elif S[i] == 'C': S[i] = 'D' elif S[i] == 'D': S[i] = 'A' S = ''.join(S) return "Yes" if S == T else "No" N = int(input().strip()) S = input().strip() T = input().strip() print(can_transform(S, T))