S = [c for c in eval(input())]

T = [c for c in eval(input())]

ST = [[s,t] for s,t in zip(S,T)]

S_dict = {}

T_dict = {}

for s,t in ST:

    if s not in S_dict:

        S_dict[s] = [t]

    elif t not in S_dict[s]:

        S_dict[s].append(t)

    if t not in T_dict:

        T_dict[t] = [s]

    elif s not in T_dict[t]:

        T_dict[t].append(s)



S_tmp = max([len(x) for x in list(S_dict.values())])

T_tmp = max([len(x) for x in list(T_dict.values())])

tmp = max(S_tmp, T_tmp)

flag = True if tmp < 2 else False

print(('Yes' if flag else 'No'))

# print(S_dict)
s = eval(input())

t = eval(input())



ans = {c:[] for c in 'abcdefghijklmnopqrstuvwxyz'}

res = {c:[] for c in 'abcdefghijklmnopqrstuvwxyz'}

cnt = 0

for a,b in zip(s,t):

    ans[b].append(a)

    res[a].append(b)

    # elif ans[a] != a and ans[ans[a]] != ans[b]:

    #     print(a, b, '0', a, b, ans[a],  ans[b], cnt)

    #     print('No')

    #     break

    cnt += 1



aa = [0 for v in list(ans.values()) if len(set(v)) > 1]

bb = [0 for v in list(res.values()) if len(set(v)) > 1]



if len(aa) == 0 and len(bb) == 0:

    print('Yes')

else:

    print('No')

# print(ans)

S = [c for c in eval(input())]
T = [c for c in eval(input())]
ST = [[s, t] for s, t in zip(S, T)]
S_dict = {}
T_dict = {}
for s, t in ST:
    if s not in S_dict:
        S_dict[s] = [t]
    elif t not in S_dict[s]:
        S_dict[s].append(t)
    if t not in T_dict:
        T_dict[t] = [s]
    elif s not in T_dict[t]:
        T_dict[t].append(s)
S_tmp = max([len(x) for x in list(S_dict.values())])
T_tmp = max([len(x) for x in list(T_dict.values())])
tmp = max(S_tmp, T_tmp)
flag = True if tmp < 2 else False
print(("Yes" if flag else "No"))
# print(S_dict)

s = eval(input())
t = eval(input())
ans = {c: [] for c in "abcdefghijklmnopqrstuvwxyz"}
res = {c: [] for c in "abcdefghijklmnopqrstuvwxyz"}
cnt = 0
for a, b in zip(s, t):
    ans[b].append(a)
    res[a].append(b)
    # elif ans[a] != a and ans[ans[a]] != ans[b]:
    #     print(a, b, '0', a, b, ans[a],  ans[b], cnt)
    #     print('No')
    #     break
    cnt += 1
aa = [0 for v in list(ans.values()) if len(set(v)) > 1]
bb = [0 for v in list(res.values()) if len(set(v)) > 1]
if len(aa) == 0 and len(bb) == 0:
    print("Yes")
else:
    print("No")
# print(ans)

-S = [c for c in eval(input())] -T = [c for c in eval(input())] -ST = [[s, t] for s, t in zip(S, T)] -S_dict = {} -T_dict = {} -for s, t in ST: -    if s not in S_dict: -        S_dict[s] = [t] -    elif t not in S_dict[s]: -        S_dict[s].append(t) -    if t not in T_dict: -        T_dict[t] = [s] -    elif s not in T_dict[t]: -        T_dict[t].append(s) -S_tmp = max([len(x) for x in list(S_dict.values())]) -T_tmp = max([len(x) for x in list(T_dict.values())]) -tmp = max(S_tmp, T_tmp) -flag = True if tmp < 2 else False -print(("Yes" if flag else "No")) -# print(S_dict) +s = eval(input()) +t = eval(input()) +ans = {c: [] for c in "abcdefghijklmnopqrstuvwxyz"} +res = {c: [] for c in "abcdefghijklmnopqrstuvwxyz"} +cnt = 0 +for a, b in zip(s, t): +    ans[b].append(a) +    res[a].append(b) +    # elif ans[a] != a and ans[ans[a]] != ans[b]: +    #     print(a, b, '0', a, b, ans[a],  ans[b], cnt) +    #     print('No') +    #     break +    cnt += 1 +aa = [0 for v in list(ans.values()) if len(set(v)) > 1] +bb = [0 for v in list(res.values()) if len(set(v)) > 1] +if len(aa) == 0 and len(bb) == 0: +    print("Yes") +else: +    print("No") +# print(ans)