S = eval(input())

T = eval(input())

S_dic = [-1 for _ in range(26)]

T_dic = [-1 for _ in range(26)]



alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",

            "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",

            "w", "x", "y", "z"]



for i in range(len(S)):

    s = S[i]

    t = T[i]

    si = alphabet.index(s)

    ti = alphabet.index(t)



    if S_dic[si] == -1:

        S_dic[si] = ti

    elif S_dic[si] != ti:

        print("No")

        exit()



    if T_dic[ti] == -1:

        T_dic[ti] = si

    elif T_dic[ti] != si:

        print("No")

        exit()



print("Yes")
S = eval(input())

T = eval(input())

S_dic = {}

T_dic = {}



for i in range(len(S)):

    s = S[i]

    t = T[i]

    if s in S_dic:

        S_dic[s] += 1

    else:

        S_dic[s] = 1



    if t in T_dic:

        T_dic[t] +=1



    else:

        T_dic[t] = 1



S_dic = sorted(list(S_dic.items()), key= lambda x:x[1])

T_dic = sorted(list(T_dic.items()), key=lambda x:x[1])

f = True

if len(S_dic) >= len(T_dic):

    length = len(T_dic)

else:

    length = len(S_dic)

for i in range(length):

    s = S_dic[i][1]

    t = T_dic[i][1]

    if s != t:

        f = False



if f:

    print("Yes")

else:

    print("No")

S = eval(input())
T = eval(input())
S_dic = [-1 for _ in range(26)]
T_dic = [-1 for _ in range(26)]
alphabet = [
    "a",
    "b",
    "c",
    "d",
    "e",
    "f",
    "g",
    "h",
    "i",
    "j",
    "k",
    "l",
    "m",
    "n",
    "o",
    "p",
    "q",
    "r",
    "s",
    "t",
    "u",
    "v",
    "w",
    "x",
    "y",
    "z",
]
for i in range(len(S)):
    s = S[i]
    t = T[i]
    si = alphabet.index(s)
    ti = alphabet.index(t)
    if S_dic[si] == -1:
        S_dic[si] = ti
    elif S_dic[si] != ti:
        print("No")
        exit()
    if T_dic[ti] == -1:
        T_dic[ti] = si
    elif T_dic[ti] != si:
        print("No")
        exit()
print("Yes")

S = eval(input())
T = eval(input())
S_dic = {}
T_dic = {}
for i in range(len(S)):
    s = S[i]
    t = T[i]
    if s in S_dic:
        S_dic[s] += 1
    else:
        S_dic[s] = 1
    if t in T_dic:
        T_dic[t] += 1
    else:
        T_dic[t] = 1
S_dic = sorted(list(S_dic.items()), key=lambda x: x[1])
T_dic = sorted(list(T_dic.items()), key=lambda x: x[1])
f = True
if len(S_dic) >= len(T_dic):
    length = len(T_dic)
else:
    length = len(S_dic)
for i in range(length):
    s = S_dic[i][1]
    t = T_dic[i][1]
    if s != t:
        f = False
if f:
    print("Yes")
else:
    print("No")

-S_dic = [-1 for _ in range(26)] -T_dic = [-1 for _ in range(26)] -alphabet = [ -    "a", -    "b", -    "c", -    "d", -    "e", -    "f", -    "g", -    "h", -    "i", -    "j", -    "k", -    "l", -    "m", -    "n", -    "o", -    "p", -    "q", -    "r", -    "s", -    "t", -    "u", -    "v", -    "w", -    "x", -    "y", -    "z", -] +S_dic = {} +T_dic = {} -    si = alphabet.index(s) -    ti = alphabet.index(t) -    if S_dic[si] == -1: -        S_dic[si] = ti -    elif S_dic[si] != ti: -        print("No") -        exit() -    if T_dic[ti] == -1: -        T_dic[ti] = si -    elif T_dic[ti] != si: -        print("No") -        exit() -print("Yes") +    if s in S_dic: +        S_dic[s] += 1 +    else: +        S_dic[s] = 1 +    if t in T_dic: +        T_dic[t] += 1 +    else: +        T_dic[t] = 1 +S_dic = sorted(list(S_dic.items()), key=lambda x: x[1]) +T_dic = sorted(list(T_dic.items()), key=lambda x: x[1]) +f = True +if len(S_dic) >= len(T_dic): +    length = len(T_dic) +else: +    length = len(S_dic) +for i in range(length): +    s = S_dic[i][1] +    t = T_dic[i][1] +    if s != t: +        f = False +if f: +    print("Yes") +else: +    print("No")