N = int(eval(input()))

W = []

for i in range(N):

    w = eval(input())

    W.append(w)



bag = set(W)

zipped = [(W[i-1], W[i]) for i in range(1, len(W))]

valid = len(bag) == len(W) and all(p[-1] == q[0] for p, q in zipped)



print(('Yes' if valid else 'No'))
N = int(input())

w = [input() for _ in range(N)]



bigram = [(w[i-1], w[i]) for i in range(1, len(w))]

valid  = len(set(w)) == len(w) and \

         all(a[-1] == b[0] for a, b in bigram)



print('Yes' if valid else 'No')

N = int(eval(input()))
W = []
for i in range(N):
    w = eval(input())
    W.append(w)
bag = set(W)
zipped = [(W[i - 1], W[i]) for i in range(1, len(W))]
valid = len(bag) == len(W) and all(p[-1] == q[0] for p, q in zipped)
print(("Yes" if valid else "No"))

N = int(input())
w = [input() for _ in range(N)]
bigram = [(w[i - 1], w[i]) for i in range(1, len(w))]
valid = len(set(w)) == len(w) and all(a[-1] == b[0] for a, b in bigram)
print("Yes" if valid else "No")

-N = int(eval(input())) -W = [] -for i in range(N): -    w = eval(input()) -    W.append(w) -bag = set(W) -zipped = [(W[i - 1], W[i]) for i in range(1, len(W))] -valid = len(bag) == len(W) and all(p[-1] == q[0] for p, q in zipped) -print(("Yes" if valid else "No")) +N = int(input()) +w = [input() for _ in range(N)] +bigram = [(w[i - 1], w[i]) for i in range(1, len(w))] +valid = len(set(w)) == len(w) and all(a[-1] == b[0] for a, b in bigram) +print("Yes" if valid else "No")