from collections import defaultdict as dd N = int(input()) S = list(input()) T = list(input()) dic = dd(lambda:0) for i in range(N): if S[i] == "B" and T[i] == "A": print("No") exit() elif S[i] == "C" and (T[i] == "B" or T[i] == "A"): print("No") exit() elif S[i] == T[i]: continue s = S[i]+T[i] dic[s] += 1 if 0