s=eval(input());t=eval(input())

u=[];c=0

for i in range(len(s)):

  v=[s[i],t[i]]

  if v not in u:

    u.append(v)

for k in range(len(u)):

  for m in range(len(u)):

    if u[k][0]==u[m][0]:

      if u[k][1]!=u[m][1]:c+=1

for p in range(len(u)):

  for q in range(len(u)):

    if u[p][1]==u[q][1]:

      if u[p][0]!=u[q][0]:c+=1

if c==0:print('Yes')

else:print('No')
import sys

s=list(eval(input()))

t=list(eval(input()))

c=[chr(i) for i in range(97, 97+26)]

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

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

for i in range(len(s)):

  l[c.index(s[i])].append(t[i])

  l2[c.index(t[i])].append(s[i])

for i in range(26):

  l[i]=list(set(l[i]))

  l2[i]=list(set(l2[i]))

for i in range(26):

  if len(l[i])>=2:

    print('No')

    sys.exit()

  if len(l2[i])>=2:

    print('No')

    sys.exit()

print('Yes')
s = eval(input())
t = eval(input())
u = []
c = 0
for i in range(len(s)):
    v = [s[i], t[i]]
    if v not in u:
        u.append(v)
for k in range(len(u)):
    for m in range(len(u)):
        if u[k][0] == u[m][0]:
            if u[k][1] != u[m][1]:
                c += 1
for p in range(len(u)):
    for q in range(len(u)):
        if u[p][1] == u[q][1]:
            if u[p][0] != u[q][0]:
                c += 1
if c == 0:
    print("Yes")
else:
    print("No")

import sys

s = list(eval(input()))
t = list(eval(input()))
c = [chr(i) for i in range(97, 97 + 26)]
l = [[] for i in range(26)]
l2 = [[] for i in range(26)]
for i in range(len(s)):
    l[c.index(s[i])].append(t[i])
    l2[c.index(t[i])].append(s[i])
for i in range(26):
    l[i] = list(set(l[i]))
    l2[i] = list(set(l2[i]))
for i in range(26):
    if len(l[i]) >= 2:
        print("No")
        sys.exit()
    if len(l2[i]) >= 2:
        print("No")
        sys.exit()
print("Yes")

-s = eval(input()) -t = eval(input()) -u = [] -c = 0 +import sys + +s = list(eval(input())) +t = list(eval(input())) +c = [chr(i) for i in range(97, 97 + 26)] +l = [[] for i in range(26)] +l2 = [[] for i in range(26)] -    v = [s[i], t[i]] -    if v not in u: -        u.append(v) -for k in range(len(u)): -    for m in range(len(u)): -        if u[k][0] == u[m][0]: -            if u[k][1] != u[m][1]: -                c += 1 -for p in range(len(u)): -    for q in range(len(u)): -        if u[p][1] == u[q][1]: -            if u[p][0] != u[q][0]: -                c += 1 -if c == 0: -    print("Yes") -else: -    print("No") +    l[c.index(s[i])].append(t[i]) +    l2[c.index(t[i])].append(s[i]) +for i in range(26): +    l[i] = list(set(l[i])) +    l2[i] = list(set(l2[i])) +for i in range(26): +    if len(l[i]) >= 2: +        print("No") +        sys.exit() +    if len(l2[i]) >= 2: +        print("No") +        sys.exit() +print("Yes")