s = eval(input())

n = len(s)

for i in range((n - 1)//4):

    if not(s[i] == s[(n-1)//2-i-1] and s[(n+3)//2 + i-1] ==  s[-i-1] and s[i] == s[-i-1]):

        print('No')

        exit()

if (n-1)%4 != 0:

    j = (n - 1) // 4

    if s[j] != s[-j-1]:

        print('No')

        exit()

print('Yes')
s = eval(input())

n = len(s)

for i in range((n-1+3)//4):# 切り上げ

    if not(s[i] == s[(n-1)//2-i-1] and s[(n+3)//2 + i-1] ==  s[-i-1] and s[i] == s[-i-1]):

        print('No')

        exit()

print('Yes')
s = eval(input())
n = len(s)
for i in range((n - 1) // 4):
    if not (
        s[i] == s[(n - 1) // 2 - i - 1]
        and s[(n + 3) // 2 + i - 1] == s[-i - 1]
        and s[i] == s[-i - 1]
    ):
        print("No")
        exit()
if (n - 1) % 4 != 0:
    j = (n - 1) // 4
    if s[j] != s[-j - 1]:
        print("No")
        exit()
print("Yes")

s = eval(input())
n = len(s)
for i in range((n - 1 + 3) // 4):  # 切り上げ
    if not (
        s[i] == s[(n - 1) // 2 - i - 1]
        and s[(n + 3) // 2 + i - 1] == s[-i - 1]
        and s[i] == s[-i - 1]
    ):
        print("No")
        exit()
print("Yes")

-for i in range((n - 1) // 4): +for i in range((n - 1 + 3) // 4):  # 切り上げ -if (n - 1) % 4 != 0: -    j = (n - 1) // 4 -    if s[j] != s[-j - 1]: -        print("No") -        exit()