Takahashi is practicing shiritori alone again today.
Shiritori is a game as follows:
 - In the first turn, a player announces any one word.
 - In the subsequent turns, a player announces a word that satisfies the following conditions:
 - That word is not announced before.
 - The first character of that word is the same as the last character of the last word announced.
In this game, he is practicing to announce as many words as possible in ten seconds.
You are given the number of words Takahashi announced, N, and the i-th word he announced, W_i, for each i. Determine if the rules of shiritori was observed, that is, every word announced by him satisfied the conditions.

-----Constraints-----
 - N is an integer satisfying 2 \leq N \leq 100.
 - W_i is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.

-----Input-----
Input is given from Standard Input in the following format:
N
W_1
W_2
:
W_N

-----Output-----
If every word announced by Takahashi satisfied the conditions, print Yes; otherwise, print No.

-----Sample Input-----
4
hoge
english
hoge
enigma

-----Sample Output-----
No

As hoge is announced multiple times, the rules of shiritori was not observed.

Difficulty: introductory

Starter code:

Solutions:
import collections
n = int(input())
words = [input() for _ in range(n)]
ok = True
for i in range(n-1):
    if words[i][-1] != words[i+1][0]:
        ok = False
count = collections.Counter(words)
for i in count.values():
    if i != 1:
        ok = False
print("Yes" if ok else "No")

import sys
n=int(input())
w=[]
for i in range(n):
  w.append(input())

if len(w)!=len(set(w)):
  print('No')
  return

for i in range(n-1):
  p=list(w[i])
  q=list(w[i+1])
  if p[-1]!=q[0]:
    print('No')
    return
  
print('Yes')

N = int (input ())
l = []
S = 'Yes'
A = input ()
W = A[-1]
l.append (A)
for i in range (N-1):
  A = input ()
  if A[0] != W or l.count(A) != 0:
    S = 'No'
    break
  l.append (A)
  W = A[-1]
print (S)

n=int(input())
w = [(input()) for _ in range(n)]
l = set(w)
if len(w) != len(l):
        print('No')
        return
for i in range(n-1):
        if w[i][len(w[i])-1] != w[i+1][0]:
                print('No')
                return
print('Yes')

n = int(input())
s = set()

ok = True
t = input()
p = t[-1]
s.add(t)
for i in range(n-1):
    t = input()
    if t in s:
        ok = False
    s.add(t)
    if t[0] != p:
        ok = False
    p = t[-1]

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


import os
import sys
from collections import defaultdict, Counter, deque
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy


def main():
    n = int(input())
    vectoer = []
    flag = True
    for i in range(n):
        s = input()
        vectoer.append(s)

    if len(vectoer) != len(set(vectoer)):
        flag = False
        
    for i in range(n-1):
        if vectoer[i][-1] !=  vectoer[i+1][0]:
            flag = False
            break

    if flag:
        print("Yes")
    else:
        print("No")
    

def __starting_point():
	main()

__starting_point()

n = int(input())
W = [input() for i in range(n)]
word = W[0]
words = [word]
for i in range(1,n):
  if W[i] in words or word[-1] != W[i][0]:
    print("No")
    break
  word = W[i]
  words.append(word)
else:
  print("Yes")

n=int(input())

w_list=[input()]


ans="Yes"

for i in range(n-1):
    w=input()
    if w not in w_list and w_list[-1][-1]==w[0]:
        w_list.append(w)
    else:
        ans="No"
        break

print(ans)

n = int(input())
w = [input() for _ in range(n)]
# 同じ文字列が含まれていない
if len(set(w)) != n:
    print('No')
    return
# 末尾と先頭の文字が同じ（しりとり）
for i in range(1,n):
    if w[i-1][-1] != w[i][0]:
        print('No')
        return
print('Yes')


n = int(input())
a = []
for i in range(n):
  a.append(input())
  if i > 0 and (a[i - 1][-1] != a[i][0] or a.count(a[i]) == 2):
    print("No")
    break
else:
  print("Yes")

n = int(input())
w = [input() for i in range(n)]
flag = False
if len(w) == len(set(w)):
  if all(w[i-1][-1] == w[i][0] for i in range(1, n)):
    flag = True
print("Yes" if flag else "No")

n = int(input())

arr = []
ans = 'Yes'
for _ in range(n):
    w = input()
    if w in arr:
        ans = 'No'

    if len(arr) >= 1:
        if w[0] != arr[-1][-1]:
            ans = 'No'

    arr.append(w)

print(ans)

n = int(input())
w = [input()]
for i in range(n-1):
  s = input()
  if s in w or w[i][-1] != s[0]:
    print("No")
    return
  w.append(s)
print("Yes")

import collections
N = int(input())
W = []
f = input()
W.append(f)
ans = "Yes"
for _ in range(N-1):
    w = input()
    if f[-1] != w[0]:
        ans = "No"
    W.append(w)
    f = w
    
cnt = collections.Counter(W)
for v in cnt.values():
    if v >= 2:
        ans = "No"
        
print(ans)

import math
import itertools
import sys

n=int(input())
last=input()
log=[]
log.append(last)
q=[]
ans="Yes"
for i in range(n-1):
    tmp=input()
    q.append(tmp)
for i in q:
    if(i[0]!=last[-1] or i in log):
        ans="No"
        break
    else:
        last=i
        log.append(i)
print(ans)


#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    words=[]
    n = int(input())
    words=[input().rstrip() for _ in range(n)]

    if len(set(words))!=n:
        print("No")
        return

    endstring=""
    for word in words:
        if len(endstring)==0:
            endstring=word[-1]
        else:
            if endstring==word[0]:
                endstring=word[-1]
            else:
                print("No")
                return
    print("Yes")


def __starting_point():
    main()
__starting_point()

N = int(input())
W = []
for i in range(N):
  W.append(str(input()))

flag = True
for i in range(1, N):
	if W[i-1][-1] != W[i][0]:
		print('No')
		return
	for j in range(i-1):
		if W[j] == W[i]:
			print('No')
			return

print('Yes')

n = int(input())
l = []
w = [0]*n
for i in range(n):
	w[i] = input()
	if w[i] in l:
		print('No')
		return
	l.append(w[i])
	if (i >= 1 and w[i-1][-1] == w[i][0]) or i == 0:
		continue
	else:
		print('No')
		return
print('Yes')

N = int(input())
li = []
flag = True
for i in range(N):
    word = input()
    if i != 0:
        if pre_word[len(pre_word)-1] != word[0] or word in li:
            flag = False
            break
    li.append(word)
    pre_word = word
if flag:
    print('Yes')
else:
    print('No')

N = int(input())
l = [str(input())]
for i in range(N-1):
  w = str(input())
  if w in l:
    print('No')
    return
  elif l[-1][-1] != w[0]:
    print('No')
    return
  else:
    l.append(w)
print('Yes')

N = int(input())
s = set()
t = input()
s.add(t)
ans = True
for i in range(N-1):
  q = input()
  if t[-1] != q[0] or q in s:
    ans = False
  s.add(q)
  t = q
print("Yes") if ans else print("No")

N=int(input())
W=list(input() for i in range(N))

for i in range(N-1):
	if W.count(W[i]) == 2:
		print("No")
		break
	if W[i][-1] != W[i+1][0]:
		print("No")
		break
else:
	print("Yes")

N = int(input())
W = [input() for _ in range(N)]
used = []

first = W[0]
used.append(first)

for index in range(1, len(W)):
    if W[index][0] == W[index-1][-1] and W[index] not in used:
        used.append(W[index])
    else:
        print("No")
        return
print("Yes")


N = int(input())
W = [input() for i in range(N)]

ans = 'Yes'
last = ''

for i in range(N):
    for j in range(i):
        if W[i]==W[j]:
            ans = 'No'
            
for w in W:
    W_new = [i for i in w]
    if w!=W[0] and last!=W_new[0]:
        ans = 'No'
    last = W_new[-1]

print(ans)

N = int(input())
l = []
l.append(input())
ans = 'Yes'

for i in range(1, N):
  t = input()
  if t in l:
    ans = 'No'
    break
  elif l[i-1][-1] ==  t[0]:
    l.append(t)
  else:
    ans = 'No'
    break
print(ans)

def main():
    n = int(input())
    data = [input() for _ in range(n)]

    ok = True
    if len(set(data)) != n: ok = False
    for i in range(n-1):
        if data[i][-1] != data[i+1][0]:
            ok = False

    print("Yes" if ok else "No")

main()

n=int(input())
a=[]
c=0
for _ in range(n):
    w=input()
    a.append(w)

for i in range(1,n):
    if a[i-1][-1]!=a[i][0]:
        print('No')
        return
if n != len(set(a)):
    print('No')
    return
print('Yes')

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

N = int(input())

W_list = []
check = True

for i in range(N):
  W = input()
  if i == 0:
    W_list.append(W)
    continue
    
  if W in W_list:
    check = False
    break
    
  if W_list[i-1][-1] != W[0]:
    check = False
    break
    
  W_list.append(W)
    
print(("Yes" if check else "No"))


n=int(input())
w=str(input())
a=[]
a.append(w)
for i in range(1,n):
  x=w[len(w)-1]
  w=str(input())
  if x!=w[0] or w in a:
    print("No")
    return
  a.append(w)

print("Yes")

N = int(input())
L = []
for _ in range(N):
  W = str(input())
  if W in L:
    print('No')
    return
  L.append(W)
for i in range(N - 1):
  if L[i][len(L[i]) - 1] != L[i+1][0]:
    print('No')
    return
print('Yes')


n = int(input())
a = [input() for _ in range(n)]
cnt = 0
aset = set()
aset.add(a[0])
for i in range(1,n):
    if a[i][0]==a[i-1][-1] and a[i] not in aset:
        aset.add(a[i])
        cnt += 1
print("Yes" if cnt==n-1 else "No")

from typing import List


def answer(n: int, w: List[str]) -> str:
    if len(set(w)) != len(w):
        return 'No'

    for i in range(1, len(w)):
        if not w[i].startswith(w[i - 1][-1]):
            return 'No'

    return 'Yes'


def main():
    n = int(input())
    w = [input() for _ in range(n)]
    print((answer(n, w)))


def __starting_point():
    main()

__starting_point()

n = int(input())
tmp1=input()
tmp=tmp1[len(tmp1)-1]

s = set()
s.add(tmp1)

flg=True
for i in range(n-1):
    w = input()
    if w[0] != tmp:
        flg = False
        break
    tmp = w[len(w)-1]

    s.add(w)
    if(len(s) != i+2):
        flg = False
        break

if flg:
    print('Yes')
else:
    print('No')

N=int(input())
W=[input() for _ in range(N)]
if len(set(W))==N:
    for i in range(N-1):
        if W[i][-1]!=W[i+1][0]:
            print("No")
            break
    else:
        print("Yes")
else:
    print("No")


n = int(input())
w = [input() for i in range(n)]
bool = True
for i in range(1,n):
    if w[i][0] != w[i-1][len(w[i-1]) - 1]:
        bool = False
    for j in range(0,i):
        if w[i] == w[j]:
            bool = False
if bool:
    print('Yes')
else:
    print('No')

import sys

input = sys.stdin.readline


def main():
    N = int(input())
    W = [input().strip() for _ in range(N)]

    s = set()
    prev = ""
    for w in W:
        if w in s:
            print("No")
            return
        if prev == "":
            prev = w[-1]
        else:
            if prev == w[0]:
                prev = w[-1]
            else:
                print("No")
                return
        s.add(w)

    print("Yes")


def __starting_point():
    main()

__starting_point()

import sys
s = []

for i in range(int(input())):
    W = input()
    if W in s:
        print("No")
        return
    if len(s) != 0 and s[-1][-1] != W[0]:
        print("No")
        return
    s.append(W)
print("Yes")

n = int(input())

w_list = []
ans = 'Yes'
for _ in range(n):
    w = input()
    w_list.append(w)

if len(w_list) != len(set(w_list)):
    ans = 'No'

for i in range(n - 1):
    if (w_list[i][-1]) != (w_list[i + 1][0]):
        ans = 'No'
        break

print(ans)


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

words = set()
ok = True
for i in range(n):
    if w[i] in words:
        ok = False
        break
    elif i != 0 and w[i-1][-1] != w[i][0]:
        ok = False
        break
    words.add(w[i])
print(('Yes' if ok else 'No'))


def check_shiritori(n:int, w:list)->bool:
    if len(set(w)) < n:
        return False
    for i in range(n - 1):
        if w[i][-1] != w[i + 1][0]:
            return False
    return True


def main():
    n = int(input())
    w = []
    for i in range(n):
        w.append(input())

    if check_shiritori(n, w):
        print('Yes')
    else:
        print('No')


def __starting_point():
    main()

__starting_point()

N = int(input())
W = [input() for _ in range(N)]

d = dict()
last = W[0][0]

good = True
for w in W:
    if d.get(w) != None:
        good = False
        break
    elif w[0] != last:
        good = False
        break
    else:
        d[w] = 1
        last = w[-1]

if good:
    print("Yes")
else:
    print("No")
        


n = int(input())
w = [list(input()) for _ in range(n)]

for i in range(n):
    for j in range(n-i-1):
        if w[i] == w[-j-1]:
            print('No')
            return

for i in range(n):
    if i < n-1:
        if w[i][-1] != w[i+1][0]:
            print('No')
            return

print('Yes')

n = int(input())
w = []
ans = 'Yes'

for i in range(n):
    w.append(input())

if len(set(w)) < len(w):
    ans = 'No'

for i in range(1, n):
    if w[i][0] != w[i - 1][-1]:
        ans = 'No'

print(ans)

n = int(input())
w = [input() for _ in range(n)]
if len(set(w)) != n:
    print('No')
    return
for i in range(1,n):
    if w[i-1][-1] != w[i][0]:
        print('No')
        return
print('Yes')


n = int(input())
w = [input()]
for i in range(n-1):
    tmp = input()
    if w[i][-1] == tmp[0]:
        flg = tmp in w
        if flg == False:
            w.append(tmp)
        else:
            print('No')
            return
    else:
        print('No')
        return
print('Yes')

n = int(input())
s = input()
ws = set()
ws.add(s)
last = s[-1]
for _ in range(n-1):
    s = input()
    if s in ws or s[0] != last:
        print('No')
        break
    else:
        ws.add(s)
        last = s[-1]
else:
    print('Yes')

n = int(input())
mywords = []
for i in range(n):
    mywords.append(input())

judge = 0
for i in range(n - 1):
    if not(mywords[i][len(mywords[i]) - 1] == mywords[i + 1][0]):
        judge = 1

for i in range(n):
    if mywords.count(mywords[i]) > 1:
        judge = 1

if judge == 1:
    print("No")
else:
    print("Yes")


n=int(input())
a=[input()]
for i in range(n-1):
    tmp=input()
    if not tmp in a and tmp[0]==a[-1][-1]:
        a.append(tmp)
    else:
        break
if len(a)==n:
    print('Yes')
else:
    print('No')


n = int(input())
alist = [input() for i in range(n)]
 
if len(set(alist))==n:
  if all(alist[i][-1]==alist[i+1][0] for i in range(n-1)):
    print("Yes")
    return
print("No")

def main():
    n = int(input())
    words = [input() for _ in range(n)]
    before = words[0][0]
    for w in words:
        if words.count(w) >= 2 or before[-1] != w[0]:
            print('No')
            return
        before = w
    print('Yes')


def __starting_point():
    main()
__starting_point()

n=int(input())
w=[]
for i in range(n):
  w.append(input())
ans=True
for i in range(n-1):
  if w[i][-1]!=w[i+1][0]:
    ans=False
if len(set(w))!=n:
  ans=False
if ans:
  print('Yes')
else:
  print('No')

N = int(input())
W = [input() for i in range(N)]

if len(set(W)) != len(W):
    print("No")
    return

for i in range(N-1):
    if W[i][-1] == W[i + 1][0]:
        continue
    else:
        print("No")
        return

print("Yes")

n = int(input())
www = [input() for _ in range(n)]
ans = 'Yes'
if len(list(set(www))) != n:
    ans = 'No'
else:
    for i in range(1, n):
        if www[i][0] != www[i - 1][-1]:
            ans = 'No'
print(ans)

N = int(input())
words = set()
W = [input() for _ in range(N)]
res = False

for i in range(N - 1):
    if W[i] in words:
        res = True
    words.add(W[i])
    if W[i][-1] != W[i + 1][0]:
        res = True

if W[-1] in words:
    res = True

print('YNeos'[res::2])

N = int(input())
W = [input() for n in range(N)]
for i in range(N - 1):
    if W[i][-1] != W[i + 1][0] or W[i + 1] in W[0:i:1]:
        print('No')
        break
else:
    print('Yes')

N = int(input())

alter_str = input()
str_list = [alter_str]
for _ in range(N-1):
    input_str = input()
    if input_str in str_list:
        print('No')
        break
    if input_str[0] != alter_str[-1]:
        print('No')
        break
    else:
        str_list.append(input_str)
        alter_str = input_str
else:
    print('Yes')

from collections import Counter

n=int(input())
l=[input() for i in range(n)]

if Counter(l).most_common()[0][1] != 1:
  ans="No"
else:
  l_head = [l[i+1][0] for i in range(n-1)]
  l_tail = [l[i][-1] for i in range(n-1)]
  if l_head == l_tail:
    ans="Yes"
  else:
    ans="No"
    
print(ans)


N = int(input())
m = dict()

prev = input()
m[prev] = True
flg = True

for _ in range(N - 1):
  s = input()
  flg = flg and s not in m
  flg = flg and prev[len(prev) - 1] == s[0]
  m[s] = True
  prev = s

print("Yes" if flg else "No")

n = int(input())
seen = set()
tmp = ""
for _ in range(n):
    x = input()
    if not tmp:
        seen.add(x)
        tmp = x[-1]
        continue
    elif x[0] != tmp or x in seen:
        print("No")
        return
    else:
        seen.add(x)
        tmp = x[-1]
print("Yes")


N = int(input())
W = []
for i in range(N):
    W.append(input())

False_cnt = 0
for i in range(N):
    if W.count(W[i]) >= 2:
        False_cnt += 1

for i in range(N-1):
    x = W[i]
    y = W[i + 1]
    if not x[-1] == y[0]:
        False_cnt += 1

if False_cnt == 0:
    print('Yes')
else:
    print('No')

N = int(input())
W = list(input() for i in range(N))

W_len = len(W)

import sys
for i in range(0,W_len):
    n = i + 1
    while n <= W_len - 1:
        if W[i] == W[n]:
            print("No")
            return
        else:
            n += 1

x = 0
while x <= W_len - 2:
    if not W[x][-1] == W[x + 1][0]:
        print("No")
        return
    else:
        x += 1
print("Yes")




N = int(input())

W = []

for i in range(N):
    W.append(input())

cnt = set()
last = W[0][-1]
for i, w in enumerate(W):
    if i == 0:
        cnt.add(w)
        continue
    if w[0] != last:
        print('No')
        return
    last = w[-1]
    cnt.add(w)
    if i+1 != len(cnt):
        print('No')
        return

print('Yes')


n = int(input())
w = input()
s = set([w])
l = w[-1]
for i in range(n-1):
    w = input()
    if w not in s:
        s.add(w)
        if w[0] != l:
            print("No")
            break
        else:
            l = w[-1]
    else:
        print("No")
        break
else:
    print("Yes")

n = int(input())
words = []
for _ in range(n):
    words.append(input())

sets = set(words)
if len(sets) != len(words):
    ans = 'No'
else:
    for i in range(1, n, 1):
        if words[i-1][-1] != words[i][0]:
            ans = 'No'
            break
        else:
            ans = 'Yes'

print(ans)

# ABC109
# B Shiritori
N = int(input())
W = [input() for _ in range(N)]
if len(W) != len(set(W)):
    print("No")
    return
else:
    for i in range(N-1):
        if W[i][-1] != W[i+1][0]:
            print("No")
            return
pass
print("Yes")


n=int(input())
S=input()
last=S[-1]
D=set()
D.add(S)
for i in range(n-1):
	S=input()
	D.add(S)
	if S[0]==last:
		last=S[-1]
	else:
		print('No')
		return
if len(D)==n:
	print('Yes')
else:
	print('No')

N = int(input())
m = dict()

prev = input()
m[prev] = True
flg = True

for _ in range(N - 1):
  s = input()
  flg = all([flg, s not in m, prev[len(prev) - 1] == s[0]])
  m[s] = True
  prev = s

print("Yes" if flg else "No")

import sys
n, *s = sys.stdin.read().split()
seen = set()
tmp = s[0][0]

for x in s:
    if x[0] != tmp or x in seen:
        print("No")
        return
    else:
        seen.add(x)
        tmp = x[-1]
print("Yes")


n = int(input())
used = list(input() for x in range(n))
ans = "Yes"
for i in range(n-1): 
  if used.count(used[i]) == 2:
    ans = "No"
    break
  if used[i][-1] != used[i+1][0]:
    ans = "No"
print(ans)

N = int(input())

used_word_set = set()

last_char = '@'
for i in range(N):
    w = input()
    
    if i != 0 and (w in used_word_set or last_char != w[0]):
        print("No")
        return
        
    last_char = w[-1]
    used_word_set.add(w)
    
print("Yes")

N = int(input())

lst = []

for i in range(N):
    W = input()
    lst.append(W)

for n in range(1, N):
    if lst[n][0] != lst[n-1][-1] or lst.count(lst[n])>=2:
        print('No')
        break
else:
    print('Yes')

N = int(input())
W = [input() for i in range(N)]

if len(set(W)) != N:
    print("No")
    return

for i in range(1, N):
    if W[i-1][-1] != W[i][0]:
        print("No")
        return

print("Yes")

n = int(input())
w = list(input() for _ in range(n))
ans = True
w2 = set(w)
if len(w) != len(w2):
    ans = False
for i in range(n-1):
    if w[i][-1] != w[i+1][0]:
        ans = False
if ans:
    print("Yes")
else:
    print("No")

import sys
import math

#https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

ans = "Yes"
N = ini()
words = []
for _ in range(N):
    words.append(input())


if len(words) != len(set(words)):
    ans = "No"

for i in range(N-1):
    if words[i][len(words[i])-1] != words[i+1][0]:
        ans = "No"

print(ans)



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

for i in range(n-1):
    if w[i][-1] != w[i+1][0]:
        print('No')
        return

if len(set(w)) != n:
    print('No')
else:
    print('Yes')

N=int(input())

li=[input() for i in range(N)]

temp=li[0][-1]
for j in range(N-1):
    if temp==li[j+1][0]:
        temp=li[j+1][-1]
    else:
        print("No")
        return
li.sort()

for k in range(N-1):
    if li[k]==li[k+1]:
        print("No")
        return
print("Yes")


n = int(input())
ar = []

for i in range(n):
  ar.append(input())


for i in range(n-1):
  
 
  if ar[i][-1] != ar[i+1][0]:
    print('No')
    return
  if ar.count(ar[i])>1:
    print('No')
    return
print('Yes')

n = int(input())
w_l = [ input() for _ in range(n) ]
memo = set()
b_w = w_l[0][0]
ans = 'Yes'
for w in w_l:
    if b_w == w[0]:
        if w not in memo:
            memo.add(w)
            b_w = w[-1]
            continue
    ans = 'No'
    break
print(ans)

n = int(input())
li = [input() for i in range(n)]

for i in range(n-1):
    for j in range(i+1,n):
        if li[i] == li[j]:
            print('No')
            return

for i in range(n-1):
    if li[i][-1] != li[i+1][0]:
        print('No')
        return
print('Yes')

n = int(input())
W = [input() for _ in range(n)]

if len(W) > len(set(W)):
    print("No");return

tmp = W[0][-1]
for w in W[1:]:
    if w[0] != tmp:
        print("No");return
    tmp = w[-1]

print("Yes")

N = int(input())

siritolist = []

for i in range(N):
    W = input()
    siritolist.append(W)

for i in range(1, len(siritolist)):
    back_word = list(siritolist[i-1])
    word = list(siritolist[i])
    if back_word[-1] == word[0] and i > 1:
        for j in range(i-1):
            if siritolist[i] == siritolist[j]:
                print('No')
                return
    elif back_word[-1] != word[0]:
        print('No')
        return

print('Yes')

n=int(input())
w=[""]*n
a=set()
for i in range(n):
    w[i]=input()
cnt=0
for x in w:
    if x in a:
        print("No")
        return
    else:
        if cnt>0:
            if bef!=x[0]:
                print("No")
                return
        bef=x[-1]
    cnt+=1
    a.add(x)
print("Yes")


N = int(input())
words = []

for i in range(N):
  W = input()
  if i == 0:
    top = W[-1]
    words.append(W)
  else:
    if top != W[0] or W in words:
      print("No")
      return
    else:
      top = W[-1]
      words.append(W)

print("Yes")

a = int(input())
l = []
for i in range(a):
  l.append(input())
head = l[0][0]
c = 0
if len(l) != len(set(l)):
  print("No")
  exit
else:
  for i in l:
    if i[0] != head:
      print("No")
      break
    else:
      head = i[-1]
      c += 1
if c == a:
  print("Yes")
  
  


w=[]
n= int(input())

for i in range(n):
    w.append(input())


for i in range (n):
    for j in range (i+1,n):
        if w[i] == w[j]:
            print('No')
            return

for i in range (n-1) :
    if w[i][-1] != w[i + 1][0]:
        print('No')
        return


print("Yes")



n=int(input())
s=[]
for i in range(n):
    s.append(input())
total=True
for i in range(n-1):
    if s[i][-1]!=s[i+1][0]:
        total=False
        break
    for j in range(len(s)):
        if i!=j:
            if s[i]==s[j]:
                total=False
                break
    if total==False:
        break
if total==False:
    print("No")
else:
    print("Yes")

N = int(input())
W = [input() for _ in range(N)]

if len(set(W)) != N:
    print('No')
    return

for i in range(1, N):
    if W[i][0] != W[i-1][-1]:
        print('No')
        return
print('Yes')


n=int(input())
w=list(input() for i in range(n))
a=[w[0]]
for j in range(1,n):
    if w[j] not in a and w[j][0]==a[j-1][-1]:
        a.append(w[j])
        continue
    else:
        print("No")
        break
else:
    print("Yes")

n=int(input())
w=[input() for i in range(n)]
m=w[0][-1]
for i in range(1,n):
  if w.count(w[i])==1 and m==w[i][0]:
    m=w[i][-1]
  else:
    print('No')
    return
print('Yes')

n = int(input())
s = []
res = "Yes"
for i in range(n):
  s.append(input())
  for j in range(i):
    if s[i] == s[j]:
      res = "No"
  if i != 0:
    if s[i][0] != s[i-1][len(s[i-1])-1]:
      res = "No"
print(res)      

N = int(input())
W = [input() for _ in range(N)]

if len(set(W)) != len(W):
    print("No")
    return

prev = W[0][0]
for w in W:
    if w[0] != prev:
        print("No")
        return
    prev = w[-1]
print("Yes")

n = int(input())
ans = 0
a = ''
l = []
for i in range(n):
    w = input()
    if a == w[0]:
        ans += 1
    a = w[-1]
    l.append(w)
x = 'No'
if ans == n-1 and len(set(l)) == n:
    x = 'Yes'
print(x)

n = int(input())
w = []
for _ in range(n):
    w.append(input())
a = ''
for i in range(n):
    for j in range(i):
        if w[i] == w[j]:
            print('No')
            return
for j in w:
    b = [i for i in j]
    if j != w[0] and a != b[0]:
        print('No')
        return
    a = b[-1]
print('Yes')

n=int(input())
hatsugen=[]
w=input()
hatsugen.append(w)
oshiri=w[-1]
Flag=True
for _ in range(n-1):
    w=input()
    if w[0]!=oshiri:
        Flag=False
        break
    if w in hatsugen:
        Flag=False
        break
    oshiri=w[-1]
    hatsugen.append(w)
if Flag:
    print('Yes')
else:
    print('No')

N = int(input())
words = set()
W = [input() for _ in range(N)]
res = False

for i in range(N):
    if W[i] in words:
        res = True
    words.add(W[i])
    if i < N - 1 and W[i][-1] != W[i + 1][0]:
        res = True

print('YNeos'[res::2])

n = int(input())
list_w = [input() for s in range(0, n)]
for i in range(0, n):
    if i == 0 or (list_w[i - 1][-1] == list_w[i][0]) and list_w[i] not in list_w[:i]:
        continue
    else:
        print("No")
        return
print("Yes")

n=int(input())
w=[input() for i in range(n)]
check=True
for i in range(1,n):
  for j in range(i):
    if w[i]==w[j]:
      check=False
  if w[i-1][-1]!=w[i][0]:
    check=False
print("Yes" if check else "No")

def readinput():
    n=int(input())
    w=[]
    for _ in range(n):
        w.append(input())
    return n,w

def main(n,w):
    #print(w)
    words={}
    word=w[0]
    words[w[0]] = 1 
    for i in range(1,n):
        #print(w[i])
        if w[i][0]!=word[-1]:
            return 'No'
        else:
            if w[i] not in words:
                words[w[i]] = 1
            else:
                return 'No'
        word = w[i]
    return 'Yes'

def __starting_point():
    n,w=readinput()
    ans=main(n,w)
    print(ans)

__starting_point()