import collections

n=int(eval(input()))

w=[]

for i in range(n):

    w.append(str(eval(input())))



w_count=collections.Counter(w)

if max(w_count.values())>=2:

    print("No")

    exit()



for i in range(n-1):

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

        print("No")

        exit()

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

w=[str(eval(input())) for _ in range(n)]



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

    print("No")

    exit()



for i in range(n-1):

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

        print("No")

        break

else:

    print("Yes")
import collections

n = int(eval(input()))
w = []
for i in range(n):
    w.append(str(eval(input())))
w_count = collections.Counter(w)
if max(w_count.values()) >= 2:
    print("No")
    exit()
for i in range(n - 1):
    if w[i][-1] != w[i + 1][0]:
        print("No")
        exit()
print("Yes")

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

-import collections - -w = [] -for i in range(n): -    w.append(str(eval(input()))) -w_count = collections.Counter(w) -if max(w_count.values()) >= 2: +w = [str(eval(input())) for _ in range(n)] +if len(set(w)) != n: -        exit() -print("Yes") +        break +else: +    print("Yes")