s=eval(input())

t=eval(input())

l=len(s)

c=[chr(i) for i in range(97,97+26)]

for i in range(26):

    f=0

    for j in range(l):

        if c[i]==s[j]:

            if f==0:

                k=t[j]

                f+=1

            elif f==1 and t[j]!=k:

                f+=1

                print("No")

                break

    if f==2:

        break

else:

    for i in range(26):

        f=0

        for j in range(l):

            if c[i]==t[j]:

                if f==0:

                    k=s[j]

                    f+=1

                elif f==1 and s[j]!=k:

                    f+=1

                    print("No")

                    break

        if f==2:

            break

    else:

        print("Yes")

d,d_=dict(),dict()

s,t=eval(input()),eval(input())

l=len(s)

for i in range(l):

    if s[i] not in d:

        d[s[i]]=[i]

    else:

        d[s[i]].append(i)

for i in range(l):

    if t[i] not in d_:

        d_[t[i]]=[i]

    else:

        d_[t[i]].append(i)

x=[sorted(i[1]) for i in list(d.items())]

y=[sorted(i[1]) for i in list(d_.items())]

x.sort()

y.sort()

print(("Yes" if x==y else "No"))
s = eval(input())
t = eval(input())
l = len(s)
c = [chr(i) for i in range(97, 97 + 26)]
for i in range(26):
    f = 0
    for j in range(l):
        if c[i] == s[j]:
            if f == 0:
                k = t[j]
                f += 1
            elif f == 1 and t[j] != k:
                f += 1
                print("No")
                break
    if f == 2:
        break
else:
    for i in range(26):
        f = 0
        for j in range(l):
            if c[i] == t[j]:
                if f == 0:
                    k = s[j]
                    f += 1
                elif f == 1 and s[j] != k:
                    f += 1
                    print("No")
                    break
        if f == 2:
            break
    else:
        print("Yes")

d, d_ = dict(), dict()
s, t = eval(input()), eval(input())
l = len(s)
for i in range(l):
    if s[i] not in d:
        d[s[i]] = [i]
    else:
        d[s[i]].append(i)
for i in range(l):
    if t[i] not in d_:
        d_[t[i]] = [i]
    else:
        d_[t[i]].append(i)
x = [sorted(i[1]) for i in list(d.items())]
y = [sorted(i[1]) for i in list(d_.items())]
x.sort()
y.sort()
print(("Yes" if x == y else "No"))

-s = eval(input()) -t = eval(input()) +d, d_ = dict(), dict() +s, t = eval(input()), eval(input()) -c = [chr(i) for i in range(97, 97 + 26)] -for i in range(26): -    f = 0 -    for j in range(l): -        if c[i] == s[j]: -            if f == 0: -                k = t[j] -                f += 1 -            elif f == 1 and t[j] != k: -                f += 1 -                print("No") -                break -    if f == 2: -        break -else: -    for i in range(26): -        f = 0 -        for j in range(l): -            if c[i] == t[j]: -                if f == 0: -                    k = s[j] -                    f += 1 -                elif f == 1 and s[j] != k: -                    f += 1 -                    print("No") -                    break -        if f == 2: -            break +for i in range(l): +    if s[i] not in d: +        d[s[i]] = [i] -        print("Yes") +        d[s[i]].append(i) +for i in range(l): +    if t[i] not in d_: +        d_[t[i]] = [i] +    else: +        d_[t[i]].append(i) +x = [sorted(i[1]) for i in list(d.items())] +y = [sorted(i[1]) for i in list(d_.items())] +x.sort() +y.sort() +print(("Yes" if x == y else "No"))