s = str(eval(input()))

t = str(eval(input()))

ls = [[0] for i in range(26)]

lt = [[0] for i in range(26)]



for i in range(len(s)):

    ls[ord(s[i])-97].append(i)

    lt[ord(t[i])-97].append(i)

# print(ls)

# print(lt)

for i in ls:

    f = 0

    for j in lt:

        if i==j:

            f = 1

            break

    if f == 0:

        print("No")

        exit()

print("Yes")
"""

嘘解法です.通るかな?

コーナーケース:

in:

    abab

    aabb

Out:

    Yes

    (本当はNo)

"""

s = str(eval(input()))

t = str(eval(input()))

ls = [0]*26

lt = [0]*26

for i in range(len(s)):

    ls[ord(s[i])-97] += 1

    lt[ord(t[i])-97] += 1

ls.sort()

lt.sort()

if lt == ls:

    print("Yes")

else:

    print("No")
s = str(eval(input()))
t = str(eval(input()))
ls = [[0] for i in range(26)]
lt = [[0] for i in range(26)]
for i in range(len(s)):
    ls[ord(s[i]) - 97].append(i)
    lt[ord(t[i]) - 97].append(i)
# print(ls)
# print(lt)
for i in ls:
    f = 0
    for j in lt:
        if i == j:
            f = 1
            break
    if f == 0:
        print("No")
        exit()
print("Yes")

"""
嘘解法です.通るかな?
コーナーケース:
in:
    abab
    aabb
Out:
    Yes
    (本当はNo)
"""
s = str(eval(input()))
t = str(eval(input()))
ls = [0] * 26
lt = [0] * 26
for i in range(len(s)):
    ls[ord(s[i]) - 97] += 1
    lt[ord(t[i]) - 97] += 1
ls.sort()
lt.sort()
if lt == ls:
    print("Yes")
else:
    print("No")

+""" +嘘解法です.通るかな? +コーナーケース: +in: +    abab +    aabb +Out: +    Yes +    (本当はNo) +""" -ls = [[0] for i in range(26)] -lt = [[0] for i in range(26)] +ls = [0] * 26 +lt = [0] * 26 -    ls[ord(s[i]) - 97].append(i) -    lt[ord(t[i]) - 97].append(i) -# print(ls) -# print(lt) -for i in ls: -    f = 0 -    for j in lt: -        if i == j: -            f = 1 -            break -    if f == 0: -        print("No") -        exit() -print("Yes") +    ls[ord(s[i]) - 97] += 1 +    lt[ord(t[i]) - 97] += 1 +ls.sort() +lt.sort() +if lt == ls: +    print("Yes") +else: +    print("No")