S = eval(input())

T = eval(input())



tdic = dict()

sdic = dict()

for i in range(len(S)):

    if T[i] in tdic:

        if tdic[T[i]] != S[i]:

            print("No")

            break

    else:

        tdic[T[i]] = S[i]



    if S[i] in sdic:

        if sdic[S[i]] != T[i]:

            print("No")

            break

    else:

        sdic[S[i]] = T[i]

else:

    print("Yes")
S, T = [eval(input()) for _ in range(2)]

smemo, tmemo = {}, {}

for si, ti in zip(S, T):

    if si in smemo and smemo[si] != ti or ti in tmemo and tmemo[ti] != si:

        print("No")

        quit()

    smemo[si], tmemo[ti] = ti, si

print("Yes")

S = eval(input())
T = eval(input())
tdic = dict()
sdic = dict()
for i in range(len(S)):
    if T[i] in tdic:
        if tdic[T[i]] != S[i]:
            print("No")
            break
    else:
        tdic[T[i]] = S[i]
    if S[i] in sdic:
        if sdic[S[i]] != T[i]:
            print("No")
            break
    else:
        sdic[S[i]] = T[i]
else:
    print("Yes")

S, T = [eval(input()) for _ in range(2)]
smemo, tmemo = {}, {}
for si, ti in zip(S, T):
    if si in smemo and smemo[si] != ti or ti in tmemo and tmemo[ti] != si:
        print("No")
        quit()
    smemo[si], tmemo[ti] = ti, si
print("Yes")

-S = eval(input()) -T = eval(input()) -tdic = dict() -sdic = dict() -for i in range(len(S)): -    if T[i] in tdic: -        if tdic[T[i]] != S[i]: -            print("No") -            break -    else: -        tdic[T[i]] = S[i] -    if S[i] in sdic: -        if sdic[S[i]] != T[i]: -            print("No") -            break -    else: -        sdic[S[i]] = T[i] -else: -    print("Yes") +S, T = [eval(input()) for _ in range(2)] +smemo, tmemo = {}, {} +for si, ti in zip(S, T): +    if si in smemo and smemo[si] != ti or ti in tmemo and tmemo[ti] != si: +        print("No") +        quit() +    smemo[si], tmemo[ti] = ti, si +print("Yes")