s=list(eval(input()))

t=list(eval(input()))

n=len(s)

a=[s.count(chr(97+i)) for i in range(26)]

b=[t.count(chr(97+i)) for i in range(26)]

if all(a[ord(s[i])-97]==b[ord(t[i])-97] for i in range(n)):

    print("Yes")

else:

    print("No")



s=eval(input())

t=eval(input())

n=len(s)

f=0

a=[[] for i in range(26)]

for i in range(n):

    

    if len(a[ord(s[i])-97])==0:

        a[ord(s[i])-97].append(t[i])

    else:

        if a[ord(s[i])-97][0]!=t[i]:

            f=1

x=[a[i][0] for i in range(26) if len(a[i])==1]

if len(x)!=len(set(x)):

    f=1

print(("Yes" if f==0 else "No"))



    

s = list(eval(input()))
t = list(eval(input()))
n = len(s)
a = [s.count(chr(97 + i)) for i in range(26)]
b = [t.count(chr(97 + i)) for i in range(26)]
if all(a[ord(s[i]) - 97] == b[ord(t[i]) - 97] for i in range(n)):
    print("Yes")
else:
    print("No")

s = eval(input())
t = eval(input())
n = len(s)
f = 0
a = [[] for i in range(26)]
for i in range(n):
    if len(a[ord(s[i]) - 97]) == 0:
        a[ord(s[i]) - 97].append(t[i])
    else:
        if a[ord(s[i]) - 97][0] != t[i]:
            f = 1
x = [a[i][0] for i in range(26) if len(a[i]) == 1]
if len(x) != len(set(x)):
    f = 1
print(("Yes" if f == 0 else "No"))

-s = list(eval(input())) -t = list(eval(input())) +s = eval(input()) +t = eval(input()) -a = [s.count(chr(97 + i)) for i in range(26)] -b = [t.count(chr(97 + i)) for i in range(26)] -if all(a[ord(s[i]) - 97] == b[ord(t[i]) - 97] for i in range(n)): -    print("Yes") -else: -    print("No") +f = 0 +a = [[] for i in range(26)] +for i in range(n): +    if len(a[ord(s[i]) - 97]) == 0: +        a[ord(s[i]) - 97].append(t[i]) +    else: +        if a[ord(s[i]) - 97][0] != t[i]: +            f = 1 +x = [a[i][0] for i in range(26) if len(a[i]) == 1] +if len(x) != len(set(x)): +    f = 1 +print(("Yes" if f == 0 else "No"))