s = eval(input())

t = eval(input())



from collections import defaultdict



td = defaultdict(set)

sd = defaultdict(set)

for i in range(len(s)):

        td[t[i]].add(s[i])

        sd[s[i]].add(t[i])



for tv, sv in zip(list(td.values()), list(sd.values())):

    if (len(tv) > 1) or (len(sv) > 1):

        print("No")

        break

else:

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

t = eval(input())

sl = []

tl = []

for c in "abcdefghijklmnopqrstuvwxyz":

    sl.append(s.count(c))

    tl.append(t.count(c))

if sorted(sl)==sorted(tl):

    print("Yes")

else:

    print("No")
s = eval(input())
t = eval(input())
from collections import defaultdict

td = defaultdict(set)
sd = defaultdict(set)
for i in range(len(s)):
    td[t[i]].add(s[i])
    sd[s[i]].add(t[i])
for tv, sv in zip(list(td.values()), list(sd.values())):
    if (len(tv) > 1) or (len(sv) > 1):
        print("No")
        break
else:
    print("Yes")

s = eval(input())
t = eval(input())
sl = []
tl = []
for c in "abcdefghijklmnopqrstuvwxyz":
    sl.append(s.count(c))
    tl.append(t.count(c))
if sorted(sl) == sorted(tl):
    print("Yes")
else:
    print("No")

-from collections import defaultdict - -td = defaultdict(set) -sd = defaultdict(set) -for i in range(len(s)): -    td[t[i]].add(s[i]) -    sd[s[i]].add(t[i]) -for tv, sv in zip(list(td.values()), list(sd.values())): -    if (len(tv) > 1) or (len(sv) > 1): -        print("No") -        break +sl = [] +tl = [] +for c in "abcdefghijklmnopqrstuvwxyz": +    sl.append(s.count(c)) +    tl.append(t.count(c)) +if sorted(sl) == sorted(tl): +    print("Yes") -    print("Yes") +    print("No")