flag = 0

n = int(eval(input()))

s = [eval(input()) for i in range(n)]

if len(set(s)) != n:

    flag = 1

for i in range(n-1):

    if s[i][-1] != s[i+1][0] :

        flag = 1

if flag == 1:

    print('No')

else:

    print('Yes')
n = int(eval(input()))

W = [eval(input()) for i in range(n)]

WW = set(W)

flag = 1

if len(WW) != n:

    print("No")

    exit()

else:

    for i in range(n-1):

        if W[i][-1] != W[i+1][0]:

            flag = 0

    if flag == 1:

        print("Yes")

    else:

        print("No")
flag = 0
n = int(eval(input()))
s = [eval(input()) for i in range(n)]
if len(set(s)) != n:
    flag = 1
for i in range(n - 1):
    if s[i][-1] != s[i + 1][0]:
        flag = 1
if flag == 1:
    print("No")
else:
    print("Yes")

n = int(eval(input()))
W = [eval(input()) for i in range(n)]
WW = set(W)
flag = 1
if len(WW) != n:
    print("No")
    exit()
else:
    for i in range(n - 1):
        if W[i][-1] != W[i + 1][0]:
            flag = 0
    if flag == 1:
        print("Yes")
    else:
        print("No")

-flag = 0 -s = [eval(input()) for i in range(n)] -if len(set(s)) != n: -    flag = 1 -for i in range(n - 1): -    if s[i][-1] != s[i + 1][0]: -        flag = 1 -if flag == 1: +W = [eval(input()) for i in range(n)] +WW = set(W) +flag = 1 +if len(WW) != n: +    exit() -    print("Yes") +    for i in range(n - 1): +        if W[i][-1] != W[i + 1][0]: +            flag = 0 +    if flag == 1: +        print("Yes") +    else: +        print("No")