prj = {}

prj_inv = {}

s = eval(input())

t = eval(input())

for i, j in zip(s, t):

    if i not in prj and j not in prj_inv:

        prj[i] = j

        prj_inv[j] = i

    elif i in prj and j in prj_inv:

        if prj[i] == j:

            continue

        else:

            print('No')

            break

    else:

        print('No')

        break

else:

    print('Yes')
s = eval(input())

t = eval(input())

 

s_c = []

t_c = []

for c in 'abcdefghijklmnopqrstuvwxyz':

    s_c.append(s.count(c))

    t_c.append(t.count(c))

s_c.sort()

t_c.sort()

if s_c == t_c:

  print('Yes')

else:

  print('No')
prj = {}
prj_inv = {}
s = eval(input())
t = eval(input())
for i, j in zip(s, t):
    if i not in prj and j not in prj_inv:
        prj[i] = j
        prj_inv[j] = i
    elif i in prj and j in prj_inv:
        if prj[i] == j:
            continue
        else:
            print("No")
            break
    else:
        print("No")
        break
else:
    print("Yes")

s = eval(input())
t = eval(input())
s_c = []
t_c = []
for c in "abcdefghijklmnopqrstuvwxyz":
    s_c.append(s.count(c))
    t_c.append(t.count(c))
s_c.sort()
t_c.sort()
if s_c == t_c:
    print("Yes")
else:
    print("No")

-prj = {} -prj_inv = {} -for i, j in zip(s, t): -    if i not in prj and j not in prj_inv: -        prj[i] = j -        prj_inv[j] = i -    elif i in prj and j in prj_inv: -        if prj[i] == j: -            continue -        else: -            print("No") -            break -    else: -        print("No") -        break +s_c = [] +t_c = [] +for c in "abcdefghijklmnopqrstuvwxyz": +    s_c.append(s.count(c)) +    t_c.append(t.count(c)) +s_c.sort() +t_c.sort() +if s_c == t_c: +    print("Yes") -    print("Yes") +    print("No")