S = list(eval(input()))

T = list(eval(input()))



countT = {}

countS = {}



for s, t in zip(S, T) :

    if t in countT :

        countT[t].append(s)

    else :

        countT[t] = [s]

    if s in countS :

        countS[s].append(t)

    else :

        countS[s] = [t]



for (_, s), (_, t) in zip(list(countS.items()), list(countT.items())) :

    if len(set(s)) >= 2 or len(set(t)) >= 2:

        print('No')

        break

else :

    print('Yes')

S = eval(input())

T = eval(input())



tToS = {}

sToT = {}

for s, t in zip(S, T):

    if not t in tToS:

        tToS[t] = s

    if not s in sToT:

        sToT[s] = t



    if tToS[t] != s or sToT[s] != t:

        print('No')

        exit()



print('Yes')

S = list(eval(input()))
T = list(eval(input()))
countT = {}
countS = {}
for s, t in zip(S, T):
    if t in countT:
        countT[t].append(s)
    else:
        countT[t] = [s]
    if s in countS:
        countS[s].append(t)
    else:
        countS[s] = [t]
for (_, s), (_, t) in zip(list(countS.items()), list(countT.items())):
    if len(set(s)) >= 2 or len(set(t)) >= 2:
        print("No")
        break
else:
    print("Yes")

S = eval(input())
T = eval(input())
tToS = {}
sToT = {}
for s, t in zip(S, T):
    if not t in tToS:
        tToS[t] = s
    if not s in sToT:
        sToT[s] = t
    if tToS[t] != s or sToT[s] != t:
        print("No")
        exit()
print("Yes")

-S = list(eval(input())) -T = list(eval(input())) -countT = {} -countS = {} +S = eval(input()) +T = eval(input()) +tToS = {} +sToT = {} -    if t in countT: -        countT[t].append(s) -    else: -        countT[t] = [s] -    if s in countS: -        countS[s].append(t) -    else: -        countS[s] = [t] -for (_, s), (_, t) in zip(list(countS.items()), list(countT.items())): -    if len(set(s)) >= 2 or len(set(t)) >= 2: +    if not t in tToS: +        tToS[t] = s +    if not s in sToT: +        sToT[s] = t +    if tToS[t] != s or sToT[s] != t: -        break -else: -    print("Yes") +        exit() +print("Yes")