Problem: 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.

Submission attempts (in order):
# -*- coding: utf-8 -*-
import sys
import itertools

#w=input()
from operator import itemgetter
from sys import stdin


N=3
M=3
i=0
j=0
k=0



N=int(input())
array=[input().split()for i in range(N)]


#    c.append(array[i][0])

c=list(itertools.chain.from_iterable(array))


for i in range(N-1):
    #s=input()
    a=[i for i in array[i][0]]
    b=[j for j in array[i+1][0]]
    "str型の2次元文字列分割入力もパターンに入れとくか"
    #print(a[-1],b[0])
    if a[-1]!=b[0]:
        print("No")
        sys.exit()

#print(c)
for i in range(N-1):
    #for j in reversed(range(N-i-2)):
    for j in (range(N-i-2)):
        print(c[i],c[i+j+1])
        if c[i]==c[i+j+1]:
            print("No")
            sys.exit()
print("Yes")

#print(a[0])
#print([a])



#print(array[1][0])
"[行][列]の順番であることに注意"
#print(array)
"正方行列にstr型の値を入力"

#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"



#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''








#print(type(brray[0][0]))
#print(brray)

"列数に関して自由度の高いint型の値を入力するタイプの行列"


'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()

#print(a[0])
#print([a])















#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"





#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)



# -*- coding: utf-8 -*-
import sys
import itertools

#w=input()
from operator import itemgetter
from sys import stdin


N=3
M=3
i=0
j=0
k=0



N=int(input())
array=[input().split()for i in range(N)]


#    c.append(array[i][0])

c=list(itertools.chain.from_iterable(array))


for i in range(N-1):
    #s=input()
    a=[i for i in array[i][0]]
    b=[j for j in array[i+1][0]]
    "str型の2次元文字列分割入力もパターンに入れとくか"
    #print(a[-1],b[0])
    if a[-1]!=b[0]:
        print("No")
        sys.exit()

#print(c)
for i in range(N-1):
    #for j in reversed(range(N-i-2)):
    for j in (range(N-i-1)):
        #print(c[i],c[i+j+1])
        if c[i]==c[i+j+1]:
            print("No")
            sys.exit()
print("Yes")

#print(a[0])
#print([a])



#print(array[1][0])
"[行][列]の順番であることに注意"
#print(array)
"正方行列にstr型の値を入力"

#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"



#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''








#print(type(brray[0][0]))
#print(brray)

"列数に関して自由度の高いint型の値を入力するタイプの行列"


'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()

#print(a[0])
#print([a])















#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"





#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)



Verdicts: Wrong Answer

Accepted