S = eval(input())

T = eval(input())

sid = {}

tid = {}

ss = []

tt = []

sn = 0

tn = 0

for i in range(len(S)):

    if not S[i] in sid:

        sid[S[i]] = sn

        sn += 1

    ss += [sid[S[i]]]

    if not T[i] in tid:

        tid[T[i]] = tn

        tn += 1

    tt += [tid[T[i]]]

if ss == tt:

    print('Yes')

else:

    print('No')
S = eval(input())

T = eval(input())

for i in range(len(S)):

    if S.find(S[i]) != T.find(T[i]):

        print('No')

        exit()

print('Yes')
S = eval(input())
T = eval(input())
sid = {}
tid = {}
ss = []
tt = []
sn = 0
tn = 0
for i in range(len(S)):
    if not S[i] in sid:
        sid[S[i]] = sn
        sn += 1
    ss += [sid[S[i]]]
    if not T[i] in tid:
        tid[T[i]] = tn
        tn += 1
    tt += [tid[T[i]]]
if ss == tt:
    print("Yes")
else:
    print("No")

S = eval(input())
T = eval(input())
for i in range(len(S)):
    if S.find(S[i]) != T.find(T[i]):
        print("No")
        exit()
print("Yes")

-sid = {} -tid = {} -ss = [] -tt = [] -sn = 0 -tn = 0 -    if not S[i] in sid: -        sid[S[i]] = sn -        sn += 1 -    ss += [sid[S[i]]] -    if not T[i] in tid: -        tid[T[i]] = tn -        tn += 1 -    tt += [tid[T[i]]] -if ss == tt: -    print("Yes") -else: -    print("No") +    if S.find(S[i]) != T.find(T[i]): +        print("No") +        exit() +print("Yes")