#S=input()

N=int(eval(input()))

#N,M,X,Y=map(int,input().split())

W=[]

can=True

for i in range(N):

    w=eval(input())

    if i==0:

        W.append(w)

        e=w[-1]

        continue

    s=w[0]

    if e==s and not(w in W):

        W.append(w)

        e=w[-1]

        continue

    else:

        can=False

        break

if can:

    print("Yes")

else:

    print("No")
N=int(eval(input()))

N-=1

w=eval(input())

f=w[-1]

word={w}

for i in range(N):

    w=eval(input())

    ini=w[0]

    if w in word:

        print("No")

        quit()

    if ini!=f:

        print("No")

        quit()

    word.add(w)

    f=w[-1]

print("Yes")

# S=input()
N = int(eval(input()))
# N,M,X,Y=map(int,input().split())
W = []
can = True
for i in range(N):
    w = eval(input())
    if i == 0:
        W.append(w)
        e = w[-1]
        continue
    s = w[0]
    if e == s and not (w in W):
        W.append(w)
        e = w[-1]
        continue
    else:
        can = False
        break
if can:
    print("Yes")
else:
    print("No")

N = int(eval(input()))
N -= 1
w = eval(input())
f = w[-1]
word = {w}
for i in range(N):
    w = eval(input())
    ini = w[0]
    if w in word:
        print("No")
        quit()
    if ini != f:
        print("No")
        quit()
    word.add(w)
    f = w[-1]
print("Yes")

-# S=input() -# N,M,X,Y=map(int,input().split()) -W = [] -can = True +N -= 1 +w = eval(input()) +f = w[-1] +word = {w} -    if i == 0: -        W.append(w) -        e = w[-1] -        continue -    s = w[0] -    if e == s and not (w in W): -        W.append(w) -        e = w[-1] -        continue -    else: -        can = False -        break -if can: -    print("Yes") -else: -    print("No") +    ini = w[0] +    if w in word: +        print("No") +        quit() +    if ini != f: +        print("No") +        quit() +    word.add(w) +    f = w[-1] +print("Yes")