# 1対1なので決めていく

s, t = eval(input()), eval(input())

sd, td = {}, {}

for i in range(len(s)):

    if t[i] not in td and s[i] not in sd:

        sd[s[i]] = t[i]

        td[t[i]] = s[i]

    elif t[i] in td and s[i] in sd and td[t[i]] == s[i] and sd[s[i]] == t[i]:

        continue

    else:

        print("No")

        exit()

print("Yes")

# きりみんちゃんの配信からきました

# 登場回数が同一ならいけそうなのでそうする

from string import ascii_lowercase

s, t = eval(input()), eval(input())

alphabets = ascii_lowercase

sd, td = {}, {}

for sv in s:

    if sv in sd:

        sd[sv] += 1

    else:

        sd[sv] = 1

for tv in t:

    if tv in td:

        td[tv] += 1

    else:

        td[tv] = 1

sort_sk = sorted(sd.values())

sort_tk = sorted(td.values())

print(("Yes" if sort_sk == sort_tk else "No"))
# 1対1なので決めていく
s, t = eval(input()), eval(input())
sd, td = {}, {}
for i in range(len(s)):
    if t[i] not in td and s[i] not in sd:
        sd[s[i]] = t[i]
        td[t[i]] = s[i]
    elif t[i] in td and s[i] in sd and td[t[i]] == s[i] and sd[s[i]] == t[i]:
        continue
    else:
        print("No")
        exit()
print("Yes")

# きりみんちゃんの配信からきました
# 登場回数が同一ならいけそうなのでそうする
from string import ascii_lowercase

s, t = eval(input()), eval(input())
alphabets = ascii_lowercase
sd, td = {}, {}
for sv in s:
    if sv in sd:
        sd[sv] += 1
    else:
        sd[sv] = 1
for tv in t:
    if tv in td:
        td[tv] += 1
    else:
        td[tv] = 1
sort_sk = sorted(sd.values())
sort_tk = sorted(td.values())
print(("Yes" if sort_sk == sort_tk else "No"))

-# 1対1なので決めていく +# きりみんちゃんの配信からきました +# 登場回数が同一ならいけそうなのでそうする +from string import ascii_lowercase + +alphabets = ascii_lowercase -for i in range(len(s)): -    if t[i] not in td and s[i] not in sd: -        sd[s[i]] = t[i] -        td[t[i]] = s[i] -    elif t[i] in td and s[i] in sd and td[t[i]] == s[i] and sd[s[i]] == t[i]: -        continue +for sv in s: +    if sv in sd: +        sd[sv] += 1 -        print("No") -        exit() -print("Yes") +        sd[sv] = 1 +for tv in t: +    if tv in td: +        td[tv] += 1 +    else: +        td[tv] = 1 +sort_sk = sorted(sd.values()) +sort_tk = sorted(td.values()) +print(("Yes" if sort_sk == sort_tk else "No"))