s=eval(input())

t=eval(input())



st=[]

ts=[]

for i in range(len(s)):

    st.append([s[i],t[i]])

    ts.append([t[i],s[i]])

#print(st)

st.sort()

ts.sort()

#print(st)

    

yesno="Yes"

for i in range(len(st)-1):

    sj,tj=st[len(st)-i-1]

    sk,tk=st[len(st)-i-2]

    if sj==sk and tj!=tk:

        yesno="No"

        break

    tj,sj=ts[len(ts)-i-1]

    tk,sk=ts[len(ts)-i-2]

    if tj==tk and sj!=sk:

        yesno="No"

        break

    

print(yesno)



s=list(eval(input()))

t=list(eval(input()))



a=list("abcdefghijklmnopqrstuvwxyz")



rs=dict()

rt=dict()

for i in range(26):

    rs[a[i]]=-1

    rt[a[i]]=-1



yn=""

for i in range(len(s)):

    if rs[s[i]]==-1:

        rs[s[i]]=t[i]

    else:

        if rs[s[i]]!=t[i]:

            yn="No"

            break

    if rt[t[i]]==-1:

        rt[t[i]]=s[i]

    else:

        if rt[t[i]]!=s[i]:

            yn="No"

            break

        

if yn=="No":

    print("No")

else:

    print("Yes")

        
s = eval(input())
t = eval(input())
st = []
ts = []
for i in range(len(s)):
    st.append([s[i], t[i]])
    ts.append([t[i], s[i]])
# print(st)
st.sort()
ts.sort()
# print(st)
yesno = "Yes"
for i in range(len(st) - 1):
    sj, tj = st[len(st) - i - 1]
    sk, tk = st[len(st) - i - 2]
    if sj == sk and tj != tk:
        yesno = "No"
        break
    tj, sj = ts[len(ts) - i - 1]
    tk, sk = ts[len(ts) - i - 2]
    if tj == tk and sj != sk:
        yesno = "No"
        break
print(yesno)

s = list(eval(input()))
t = list(eval(input()))
a = list("abcdefghijklmnopqrstuvwxyz")
rs = dict()
rt = dict()
for i in range(26):
    rs[a[i]] = -1
    rt[a[i]] = -1
yn = ""
for i in range(len(s)):
    if rs[s[i]] == -1:
        rs[s[i]] = t[i]
    else:
        if rs[s[i]] != t[i]:
            yn = "No"
            break
    if rt[t[i]] == -1:
        rt[t[i]] = s[i]
    else:
        if rt[t[i]] != s[i]:
            yn = "No"
            break
if yn == "No":
    print("No")
else:
    print("Yes")

-s = eval(input()) -t = eval(input()) -st = [] -ts = [] +s = list(eval(input())) +t = list(eval(input())) +a = list("abcdefghijklmnopqrstuvwxyz") +rs = dict() +rt = dict() +for i in range(26): +    rs[a[i]] = -1 +    rt[a[i]] = -1 +yn = "" -    st.append([s[i], t[i]]) -    ts.append([t[i], s[i]]) -# print(st) -st.sort() -ts.sort() -# print(st) -yesno = "Yes" -for i in range(len(st) - 1): -    sj, tj = st[len(st) - i - 1] -    sk, tk = st[len(st) - i - 2] -    if sj == sk and tj != tk: -        yesno = "No" -        break -    tj, sj = ts[len(ts) - i - 1] -    tk, sk = ts[len(ts) - i - 2] -    if tj == tk and sj != sk: -        yesno = "No" -        break -print(yesno) +    if rs[s[i]] == -1: +        rs[s[i]] = t[i] +    else: +        if rs[s[i]] != t[i]: +            yn = "No" +            break +    if rt[t[i]] == -1: +        rt[t[i]] = s[i] +    else: +        if rt[t[i]] != s[i]: +            yn = "No" +            break +if yn == "No": +    print("No") +else: +    print("Yes")