ZhenlongDai/ACPR huggingface dataset:
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = [input() for i in range(N)]
 
for num in range(N):
  if a[num] in a[:num-1]:
    print('No')
    break
  if num < N-1:
    if a[num][-1] != a[num+1][0]:
    	print('No')
    	break
  if num == N-1:
    print('Yes')

Failing test case input:
4
hoge
english
hnge
emigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())
a = [input() for i in range(N)]
 
for num in range(N):
  if num > 0:
    if a[num] in a[:num-1]:
    	print('No')
    	break
  if num < N-1:
    if a[num][-1] != a[num+1][0]:
    	print('No')
    	break
  if num == N-1:
    print('Yes')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
W = []
judge = True
a = ""
N = int(input())
for i in range(N):
    s = input()
    W.append(s)
    if i == 0:
        a = s[len(s)-1]
    else:
        if a != s[0] or s in W:
            judge = False
            break
        else:
            a = s[len(s)-1]
if judge:
    print("Yes")
else:
    print("No")

Failing test case input:
4
hoge
english
hnge
enigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
W = []
judge = True
a = ""
N = int(input())
for i in range(N):
    s = input()
    if i == 0:
        a = s[len(s)-1]
    else:
        if a != s[0] or s in W:
            judge = False
            break
        else:
            a = s[len(s)-1]
    W.append(s)
if judge:
    print("Yes")
else:
    print("No")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
lstw=[input() for _ in range(n)]
string=[]
flag=False

if len(lstw)==1:
    flag=True
elif len(lstw)==len(set(lstw)):
    for i in range(n):
        string.append(lstw[i][:1])
        string.append(lstw[i][-1:])
    for i in range(1,n):
        if string[2*i-1]==string[2*i]:
            flag=True

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


Failing test case input:
8
a
``
`aa
aaaa
``aaa
aa_aaa
ba`
aaaaaaa

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
lstw=[input() for _ in range(n)]
string=[]
flag=False
cnt=0

if len(lstw)==1:
    flag=True
elif len(lstw)==len(set(lstw)):
    for i in range(n):
        string.append(lstw[i][:1])
        string.append(lstw[i][-1:])
    for i in range(1,n):
        if string[2*i-1]==string[2*i]:
            cnt+=1
    if cnt==(n-1):
        flag=True

if flag:
    print("Yes")
else:
    print("No")
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
word_set = set()
valid = True
words = ["" for i in range(N)]
for i in range(N):
    words[i] = input()
    
for i in range(1, N):
    if words[i-1][-1] != words[i][0] or words[i] in word_set:
        valid = False
        break
    word_set.add(words[i])
    
if valid:
    print("Yes")
else:
    print("No")

Failing test case input:
4
hoge
english
hoge
enigma

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
word_set = set()
valid = True
words = ["" for i in range(N)]
for i in range(N):
    words[i] = input()

word_set.add(words[0])
for i in range(1, N):
    if words[i-1][-1] != words[i][0] or words[i] in word_set:
        valid = False
        break
    word_set.add(words[i])
    
if valid:
    print("Yes")
else:
    print("No")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
Ws=[]
for n in range(N):
    W=input()
    Ws.append(W)

for w in range(len(Ws)):
    if Ws.count(w)>1:
        print('No')
        exit()

for x in range (1,N):
    if Ws[x][0] != Ws[x-1][-1]:
        print("No")
        exit()
print("Yes")


Failing test case input:
4
hoge
english
hoge
enigma

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
N=int(input())
Ws=[]
for n in range(N):
    W=input()
    Ws.append(W)

for w in range(len(Ws)):
    if Ws.count(Ws[w])>=2:
        print("No")
        exit()
        
for x in range (1,len(Ws)):
    if Ws[x][0] != Ws[x-1][-1]:
        print("No")
        exit()

print("Yes")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=set()
yn=1
w=input()
for i in range(n-1):
    a=w[-1]
    w=input()
    s.add(w)
    if a!=w[0] or w in s:
        yn=0
        break
if yn==1:
    print('Yes')
else:
    print('No')


Failing test case input:
4
hoge
english
hnge
enigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n=int(input())
s=set()
yn=1
w=input()
s.add(w)
for i in range(n-1):
    a=w[-1]
    w=input()
    
    if a!=w[0] or w in s:
        yn=0
        break
    s.add(w)
if yn==1:
    print('Yes')
else:
    print('No')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
N = int(input())
wlist = [input() for i in range(N)]
wlist_counter = Counter(wlist)
ans = 1

if wlist_counter.most_common()[0][1] >= 2:
    ans = 0

for i in range(1,N-1):
    W_ed = wlist[i]
    W_st = wlist[i+1]
    if W_ed[-1] != W_st[0]:
        ans = 0
        break

if ans == 0:
    print("No")
elif ans == 1:
    print("Yes")


Failing test case input:
3
aca
crb
bh`

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
from collections import Counter
N = int(input())
wlist = [input() for i in range(N)]
wlist_counter = Counter(wlist)
ans = 1

if wlist_counter.most_common()[0][1] >= 2:
    ans = 0

for i in range(0,N-1):
    W_ed = wlist[i]
    W_st = wlist[i+1]
    if W_ed[-1] != W_st[0]:
        ans = 0
        break

if ans == 0:
    print("No")
elif ans == 1:
    print("Yes")
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

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

if len(set(W)) != len(W):
    print('No')
    sys.exit()

prev = W[0][-1]
for w in W[1:]:
    print(w[0], prev)
    if prev != w[0]:
        print('No')
        sys.exit()
    prev = w[-1]

print('Yes')

Failing test case input:
8
a
_`
aa`
abaa
a``aa
ba_aaa
`ba
`aaaaaa

Expected output:
No


Actual output:
_ a
No


Fixed submission (verdict: Accepted):
import sys

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

if len(set(W)) != N:
    print('No')
    sys.exit()

prev = W[0][-1]
for w in W[1:]:
    if prev != w[0]:
        print('No')
        sys.exit()
    prev = w[-1]

print('Yes')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
w=[input() for _ in range(n)]

if len(set(w))!=len(w):
  print("No")
else:
  for i in range(1,n):
    if w[i][0]!=w[i-1][-1]:
      print("No")
      exit()

print("Yes")

Failing test case input:
8
a
aa
aaa
aaaa
aaaaa
aaaaaa
aaa
aaaaaaa

Expected output:
No

Actual output:
No
Yes


Fixed submission (verdict: Accepted):
n=int(input())
w=[input() for _ in range(n)]

if len(set(w))!=len(w):
  print("No")
else:
  for i in range(1,n):
    if w[i][0]!=w[i-1][-1]:
      print("No")
      exit()
      
  print("Yes")

Problem: p03261
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())

ok = 1
tmp_list = []
for i in range(n):
    w = str(input())

    if i == 0:
        tmp = w
        continue

    else:
        if w[0] != tmp[-1] or w in tmp_list:
            ok = 0

        else:
            tmp_list.append(w)
            tmp = w

if ok == 1:
    print('Yes')
else:
    print('No')



Failing test case input:
4
hoge
english
hoge
enigma

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())

ok = 1
tmp_list = []
for i in range(n):
    w = str(input())

    if i == 0:
        tmp = w
        tmp_list.append(w)
        continue

    else:
        if w[0] != tmp[-1] or w in tmp_list:
            ok = 0

        else:
            tmp_list.append(w)
            tmp = w

if ok == 1:
    print('Yes')
else:
    print('No')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
words = []
last = ''
ans = 'Yes'
for i in range(n):
  inp = input()
  if inp in words or last != inp[-1]:
    ans = 'No'
    break
  words.append(inp)
  last = inp[-1]
print(ans)

Failing test case input:
9
basic
c
cpp
php
python
nadesico
ocaml
lua
assembly

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
start = input()
words = [start]
last = start[-1]
ans = 'Yes'
for i in range(n - 1):
  inp = input()
  if inp in words or last != inp[0]:
    ans = 'No'
    break
  words.append(inp)
  last = inp[-1]
print(ans)
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

last = None
seen = set()
for _ in range(n):
  w = input()
  if w in seen or (last and last[-1] != w):
    print("No")
    break
  seen.add(w)
  last = w
else:
  print("Yes")


Failing test case input:
9
basic
c
cpp
php
python
nadesico
ocaml
lua
assembly

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())

last = None
seen = set()
for _ in range(n):
  w = input()
  if w in seen or (last and last[-1] != w[0]):
    print("No")
    break
  seen.add(w)
  last = w
else:
  print("Yes")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
l=[input()]
for i in range(n-1):
    w=input()
    if l[-1][-1]!=w[0] or w in l:
        print("No")
        break
else:print("Yes")

Failing test case input:
3
aac
cra
agc

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n=int(input())
l=[input()]
for i in range(n-1):
    w=input()
    if l[-1][-1]!=w[0] or w in l:
        print("No")
        break
    l.append(w)
else:print("Yes")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=int(input())
b=[]
c=""
for i in range(a):
    b.append(str(input()))
for j in range(a-1):
    if b[j][-1]==b[j+1][0]:
        if len(set(b))==a:
            c="Yes"
        else:
            c="No"
            break
    else:
        c="No"
print(c)

Failing test case input:
4
hgof
english
hnge
emigma

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
a=int(input())
b=[]
c=""
for i in range(a):
    b.append(str(input()))
for j in range(a-1):
    if b[j][-1]==b[j+1][0]:
        if len(set(b))==a:
            c="Yes"
        else:
            c="No"
            break
    else:
        c="No"
        break
print(c)

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
index = 0
list1 = []
listForWord=[]
lists = []
flag =0
while index <n:
    word = input()
    list1.append(list(word))
    if index!= 0:
        length = len(lists[index-1])
        if lists[index-1][length-1] == list1[index][0]:
            if word in listForWord == False:
                pass
            else:
                frag =1
        else:
            frag =1
    lists.append(list1[index])
    listForWord.append(word)
    index+=1
    if index==n and flag ==0:
        print("Yes")
    elif index ==n and flag ==1:
        print("No")


Failing test case input:
9
b`sic
d
ncp
php
python
nadetico
ocaml
aum
absemsly

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
index=0
lists =[]
listForWords=[]
flag =0
while index<n:
    word = input()
    list1 = list(word)
    if index!=0:
        length = len(lists[index-1])
        if list1[0] == lists[index-1][length-1]:
            for li in listForWords:
                if word == li:
                    flag =1
        else:
            flag =1
    lists.append(list1)
    listForWords.append(word)
    index+=1

if flag==0:
    print("Yes")
else:
    print("No")
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N=int(input())
s=True
w1=input()
W=[w1]
for i in range(1,N):
    w2=input()
    W.append(w2)
    if len(set(W))<len(W) and w1[-1]==w2[0]:
        w1=w2
    else:
        s= False
if s:
    print("Yes")
else:
    print("No")

Failing test case input:
4
hoge
english
hnge
enigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):

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

Problem: p03261
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())

l = [None] * N

w = input()
l[0] = w
last = l[0][-1]

is_good = True

for i in range(1, N):
    w = input() 
    if last != w[-1] or (w in l):
        is_good = False
    l[i] = w

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

Failing test case input:
4
hoge
english
hnge
emigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())

l = list([input() for _ in range(N)])

is_good = True

if len(set(l)) < N:
    is_good = False

for i in range(N-1):
    if l[i][-1] != l[i+1][0]:
        is_good = False
        break

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

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
w = [input() for i in range(n)]
flag = 1



for i in range(n):
  for j in range(i+1,n-i+1):
    if w[i] == w[j]:
      flag = flag *0
    break
    
for i in range(n):
  if i == 0:
    continue
  if w[i-1][-1] == w[i][0]:
    flag = flag * 1
  else:
    flag = flag * 0
    
if flag == 1:
  print("Yes")
else:
  print("No")

Failing test case input:
8
a
aa
aaa
aaaa
aaaaa
aaa`aa
aaa
aaaaaaa

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
w = [input() for i in range(n)]
flag = 1



for i in range(n):
  for j in range(n):
    if i == j:
      continue
    if w[i] == w[j]:
      flag = flag *0
      break
    
for i in range(n):
  if i == 0:
    continue
  if w[i-1][-1] == w[i][0]:
    flag = flag * 1
  else:
    flag = flag * 0
    
if flag == 1:
  print("Yes")
else:
  print("No")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
list = [input() for _ in range(n)]
a = 'Yes'
if len(set(list))!=n:
    ans = 'No'
for i in range(n-1):
    if list[i][-1]!=list[i+1][0]:
        a = 'No'
print(a)

Failing test case input:
4
hoge
english
hoge
enigma

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
list = [input() for _ in range(n)]
a = 'Yes'
if len(set(list))!=n:
    a = 'No'
for i in range(n-1):
    if list[i][-1]!=list[i+1][0]:
        a = 'No'
print(a)
Problem: p03261
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
A = []
for x in range(N):
    a = input()
    A.append(a)
for i in range(1,N):
    if A[i-1][-1]!=A[i][0]:
        print('No')
        break
    if a in A:
        print('No')
        break
    else:
        print('Yes')

Failing test case input:
4
hoge
english
hnge
enigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
yje = [input()]
for i in range(1,n):
    now = input()
    if now in yje:
        print('No')
        break
    if yje[-1][-1] != now[0]:
        print('No')
        break
    yje.append(now)
else:
    print('Yes')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
w = [input() for _ in range(n)]
result = 'Yes'

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

nw = set(w)

if len(nw) != n:
    result = 'No'
print(result)


Failing test case input:
3
aac
cra
`gc

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
w = [input() for _ in range(n)]
result = 'Yes'

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

nw = set(w)

if len(nw) != n:
    result = 'No'
print(result)

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n = int(input())
li = []
for i in range(n):
    li.append(list(input()))
for j in range(n-1):
    if li[j][-1] != li[j+1][0]:
        print('No1')
        exit()
    for k in range(j):
        if li[j] == li[k]:
            print('No2')
            exit()
print('Yes')


Failing test case input:
9
b`sic
c
ncp
qfp
ptyhpn
nadftico
ob`ml
aum
aasemsly

Expected output:
No


Actual output:
No1


Fixed submission (verdict: Accepted):

n = int(input())
li = []
for i in range(n):
    li.append(list(input()))
for j in range(n-1):
    if li[j][-1] == li[j+1][0]:
        for k in range(j):
            if li[j] == li[k] or li[-1] == li[k]:
                print('No')
                exit()
    else:
        print('No')
        exit()
print('Yes')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
w=[input() for i in range(n)]    
count=0
if len(set(w))<len(w):
    print('No')
else:
    for i in range(n-1):
        if w[i][-1]==w[i+1][0]:
            count+=1
    if count==n-1:
        print('Yes')
    else:
        print('No')
print(count)

Failing test case input:
3
abc
arc
agc

Expected output:
No

Actual output:
No
0


Fixed submission (verdict: Accepted):
n=int(input())
w=[input() for i in range(n)]    
count=0
if len(set(w))<len(w):
    print('No')
else:
    for i in range(n-1):
        if w[i][-1]==w[i+1][0]:
            count+=1
    if count==n-1:
        print('Yes')
    else:
        print('No')
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
W={}
A={}
count=0
for i in range(N):
	A=W[i]=str(input())
for i in range(N):
	a=len(set(W[i]))
	if a>=2 and count==0:
		print("No")
		count=1
for i in range(N-1):
	s=0
	for j in W[i+1]:
		s=s+1
		if s==1:
			t=j
		for k in W[i]:
			r=k
	if t!=r and count==0:
		print("No")
		count=1
if count==0:
	print("Yes")

Failing test case input:
9
basic
c
cpp
php
python
nadesico
ocaml
lua
assembly

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
N=int(input())
W=[]
count=0
for i in range(N):
	w=str(input())
	W.append(w)
for i in range(N):
	c=0
	for j in range(N):
		if W[i]==W[j]:
			c=c+1
		if c>=2 and count==0:
			print("No")
			count=1
for i in range(N-1):
	s=0
	for j in W[i+1]:
		s=s+1
		if s==1:
			t=j
		for k in W[i]:
			r=k
	if t!=r and count==0:
		print("No")
		count=2
if count==0:
	print("Yes")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
W=[input() for i in range(N)]
if len(W)!=len(set(W)):
    print('No')
    exit()
for i in range(len(W)-1):
       if W[i][-1]==W[i+1][0]:
          ans='Yes'
       else:
           ans='No'
print(ans)


Failing test case input:
9
b`sic
c
pcp
php
python
nadesico
ocaml
mua
assembly

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N=int(input())
W=[input() for i in range(N)]
if len(W)!=len(set(W)):
    print('No')
    exit()
for i in range(len(W)-1):
       if W[i][-1]!=W[i+1][0]:
          print('No')
          exit()
print('Yes')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
w=input()
a=[w]
for i in range(n-1):
    n=input()
    if w[len(w)-1]!=n[0] or n in a:
        print('No')
        break
    a.append(n)
else:
    print('Yes')

Failing test case input:
8
a
aa
aaa
aaaa
aaaaa
aaa`aa
aa`
aaaaaaa

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
w=input()
a=[w]
for i in range(n-1):
    n=input()
    if w[len(w)-1]!=n[0] or n in a:
        print('No')
        break
    a.append(n)
    w=n
else:
    print('Yes')
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
W = {}
last=""
flg = True

w =[]

for i in range(N):
    w.append(str(input()))
    
    
for i in w:
    temp = i
    
    if temp in W:
        flg = False
        break
    else:
        W[temp] = 1
        
    if i !=0:
        if temp[0] == last:
            last  = temp[-1]
        else:
            flg = False
            break
    else:
        last = temp[-1]
            
            
            
if(flg == True):
    print("Yes")
else:
    print("No")
        

Failing test case input:
4
hoge
english
hnge
enigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())
W = {}
last=""
flg = True

w =[]

for i in range(N):
    w.append(str(input()))
    
cnt=0
for i in w:
    
    if i in W:
        flg = False
        break
    else:
        W[i] = 1
        
    if cnt !=0:
        if i[0] == last:
            last = i[-1]
        else:
            flg = False
            break
    else:
        last = i[-1]
            
    cnt+=1
        
if(flg == True):
    print("Yes")
else:
    print("No")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
N=int(input())
siritori=collections.defaultdict(int)
prev=" "
for i in range(N):
  word = input()
  if word in siritori:
    print("No")
    exit(0)
  elif prev[-1]!=word[0]:
    print("No")
    exit(0)
  siritori[word]+=1
  prev=word
print("Yes")


Failing test case input:
9
basic
c
cpp
php
python
nadesico
ocaml
lua
assembly

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
import collections
N=int(input())
siritori=collections.defaultdict(int)
prev=" "
for i in range(N):
  word = input()
  if word in siritori:
    print("No")
    exit(0)
  elif prev[-1]!=word[0] and i != 0:
    print("No")
    exit(0)
  siritori[word]+=1
  prev=word
print("Yes")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = []
for i in range(N):
   A.append(input())
S = 0
for i in range(N-1):
    if A[i][-1] == A[i+1][0]:
        S += 1

for i in range(N):
    for j in range(N):
        if i != j:
            if A[i] == A[j]:
                B = 1
            else:
                B = 0

if S == N-1 and B == 0:
    print('Yes')
else:
    print('No')

Failing test case input:
8
a
aa
aaa
aaaa
aaaaa
aaaaaa
aaa
aaaaaaa

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
A = []
for i in range(N):
   A.append(input())
S = 0
for i in range(N-1):
    if A[i][-1] == A[i+1][0]:
        S += 1
B = 0
for i in range(N):
    for j in range(N):
        if A[i] == A[j]:
            B += 1
        else:
            B += 0

if S == N-1 and B == N:
    print('Yes')
else:
    print('No')
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = [input() for _ in [0]*n]
print(l)
if len(set(l)) != n:
    print('No')
else:
    for i in range(n-1):
        print(i)
        print(list(l[i])[-1])
        print(list(l[i+1])[0])
        if list(l[i])[-1] != list(l[i+1][0]):
            print('No')
        
            
            
    
    print('Yes')


Failing test case input:
3
caa
cra
cg`

Expected output:
No


Actual output:
['caa', 'cra', 'cg`']
0
a
c
No
1
a
c
No
Yes


Fixed submission (verdict: Accepted):
n = int(input())
l = [input() for _ in [0]*n]

if len(set(l)) != n:
    print('No')
else:
    for i in range(n-1):
        
        
        
        if l[i][-1] != l[i+1][0]:
            print('No')
            break
        
            
            
        else:
            continue
    else:
        print('Yes')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
s = [str(input())]
for i in range(1, N):
    x = str(input())
    if x[0] != s[i-1][-1]:
        print('No')
        break
    s.append(x)
if len(set(s)) == len(s):
    print('Yes')
else:
    print('No')

Failing test case input:
8
a
_`
aa`
abaa
a``aa
bb_aaa
`ba
`aaaaaa

Expected output:
No


Actual output:
No
Yes


Fixed submission (verdict: Accepted):
N = int(input())
s = [str(input())]
for i in range(1, N):
    x = str(input())
    if x[0] != s[i-1][-1]:
        break
    s.append(x)
if len(set(s)) == N:
    print('Yes')
else:
    print('No')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N = int(input())
    word_list=[input() for i in range(N)]
    already_list = []
    for i, word in enumerate(word_list):
        if(i==0):
            already_list.append(word)
            continue
        if(word not in already_list and word[0] == word_list[i-1][0]):
            already_list.append(word)
        else:
            print('No')
            return
    print('Yes')




if __name__ == "__main__":
    main()

Failing test case input:
4
hoge
english
hnge
enigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
def main():
    N = int(input())
    word_list=[input() for i in range(N)]
    already_list = []
    for i, word in enumerate(word_list):
        if(i==0):
            already_list.append(word)
            continue
        if(word not in already_list and word[0] == word_list[i-1][len(word_list[i-1])-1]):
            already_list.append(word)
        else:
            print('No')
            return
    print('Yes')




if __name__ == "__main__":
    main()
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
words = [input() for _ in range(N)]

for i, w in enumerate(words):
    if words.count(w) > 1:
        print('No')
        break
    if w[0] != words[i - 1][-1]:
        print('No')
        break
else:
    print('Yes')

Failing test case input:
4
hoge
english
hnge
emigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())
words = [input() for _ in range(N)]

for i, w in enumerate(words):
    if i == 0:
        continue
    if words.count(w) > 1:
        print('No')
        break
    if w[0] != words[i - 1][-1]:
        print('No')
        break
else:
    print('Yes')

Problem: p03261
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
W = [input() for i in range(N)]

WS = list(set(W))
cnt = 0

if len(WS) != len(W):
  cnt += 1
else:
  for i in range(N-1):
      if len(W[i])!=1 and W[i][-1] != W[i+1][0]:
          cnt += 1

print('No' if cnt >0 else 'Yes')

Failing test case input:
9
b`sic
c
pcp
php
python
nadesico
ocaml
lua
assembly

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
W = [input() for i in range(N)]
 
WS = list(set(W))
cnt = 0
 
if len(WS) != len(W):
  cnt += 1
else:
  for i in range(N-1):
      if W[i][-1] != W[i+1][0]:
          cnt += 1
 
print('No' if cnt >0 else 'Yes')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = []
flag = 1
before = ""
for i in range(n):
    a1 = input()

    if i == 0:
        before = a1[len(a1)-1]
        continue
    if before != a1[0]:
        flag = 0
    before = a1[len(a1)-1]
if flag==0:
    print("No")
else:
    print("Yes")

Failing test case input:
8
a
aa
aaa
aaaa
aaaaa
aaa`aa
aaa
aaaaaaa

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
a = []
flag = 1
before = ""
def is_unique(seq):
    return len(seq) == len(set(seq))
for i in range(n):
    a1 = input()
    a.append(a1)
    if i == 0:
        before = a1[len(a1)-1]
        continue
    if before != a1[0]:
        flag = 0
    before = a1[len(a1)-1]
if is_unique(a) == False:
    flag = 0
if flag==0:
    print("No")
else:
    print("Yes")

Problem: p03261
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
w = [input() for _ in range(n)]
e = w[1][-1]
cnt = 1

for i in range(1, n):
    if w[i][0] == e:
        cnt += 1
        e = w[i][-1]

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

Failing test case input:
4
hoge
english
hnge
enigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
w = [input() for _ in range(n)]
e = w[0][-1]
cnt = 1

for i in range(1, n):
    if w[i][0] == e:
        cnt += 1
        e = w[i][-1]

if cnt == n and len(set(w)) == n:
    print('Yes')
else:
    print('No')
Problem: p03261
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
w = []
flag = "Yes"
s = input()
w.append(s)
l = s[-1]
for _ in range(n-1):
    s=input()
    if s in w:
        flag = "No"
    else:
        if s[0] != l:
            flag = "No"
        else:
            l = s[-1]
print(flag)


Failing test case input:
8
a
aa
aaa
aaaa
aaaaa
aaa`aa
aaa
aaaaaaa

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
w = []
flag = "Yes"
s = input()
w.append(s)
l = s[-1]
for _ in range(n-1):
    s=input()
    if s in w:
        flag = "No"
    else:
        w.append(s)
        if s[0] != l:
            flag = "No"
        else:
            l = s[-1]
print(flag)

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
word = []
flag = True
word.append(input())
for _ in range(N - 1):
    w = input()
    if w in word:
        flag = False
    elif word[-1][-1] != w[0]:
        flag = False
    else:
        word.append(w)

if flag:
    print('YES')
else:
    print('NO')


Failing test case input:
9
b`sic
c
ncp
qfp
ptyhon
nadftico
ob`ml
aum
aasemsly

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
N = int(input())
word = []
flag = True
word.append(input())
for _ in range(N - 1):
    w = input()
    if w in word:
        flag = False
    elif word[-1][-1] != w[0]:
        flag = False
    else:
        word.append(w)

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

Problem: p03261
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())

word_list = []
f = 0
for i, n in enumerate(range(N)):
  s = input()
  if i == 0:
    pre = s[-1]
    continue
  if s in word_list:
    f = 1
    break
  if s[-1] != pre:
    f = 1
    break
if f == 1:
  print("No")
else:
  print("Yes")

Failing test case input:
3
abc
arc
agc

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())

word_list = []
f = 0
for i, n in enumerate(range(N)):
  s = input()
  if i == 0:
    pre = s[-1]
    word_list.append(s)
    continue
  if s in word_list:
    f = 1
    break
  if s[0] != pre:
    f = 1
    break
  pre = s[-1]
  word_list.append(s)
if f == 1:
  print("No")
else:
  print("Yes")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import collections

N = int(input())
List = [list(input()) for i in range(N)]
tmp = []

for i in range(1,N-1):
    if (List[i][0] != List[i-1][-1]):
        print('No')
        sys.exit()
    tmp.append(str(List[i]))


List_dict = collections.Counter(tmp)
for i,j in List_dict.items():
    if j != 1:
        print('No')
        sys.exit()
print('Yes')

Failing test case input:
3
caa
arc
`gc

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
import sys
import collections

N = int(input())
List = [list(input())]
for i in range(1,N):
    tmp = list(input())
    if (tmp in List) == True:
        print('No')
        sys.exit()
    List.append(list(tmp))
    
    if tmp[0] != List[i-1][-1]:
        print('No')
        sys.exit()


print('Yes')
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
count = input()
inputed = []
last = ""
judge = "Yes"
for i in range(int(count)):
    new_inputed = input()
    if i != 0 and (new_inputed[0] != last or new_inputed in inputed):
        judge = "No"
        print(last, new_inputed[-1], new_inputed in inputed)
    last = new_inputed[-1]
    inputed.append(new_inputed)
print(judge)

Failing test case input:
9
b`sic
d
ncp
php
ptyhon
nadftico
ocaml
aum
absemsly

Expected output:
No


Actual output:
c d False
d p False
l m False
m y False
No


Fixed submission (verdict: Accepted):
count = input()
inputed = []
last = ""
judge = "Yes"
for i in range(int(count)):
    new_inputed = input()
    if i != 0 and (new_inputed[0] != last or new_inputed in inputed):
        judge = "No"
    last = new_inputed[-1]
    inputed.append(new_inputed)
print(judge)

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
W = [input() for _ in range(N)]
bl = True
if len(W) != len(set(W)):
    bl = False
for i in range(N-1):
    if W[i][-1] != W[i+1][0]:
        bl = False
print('Yes' if bl else 'NO')


Failing test case input:
9
b`sic
c
ncp
qfp
ptyhpn
nadftico
ob`ml
aum
aasemsly

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
N = int(input())
W = [input() for _ in range(N)]
bl = True
if len(W) != len(set(W)):
    bl = False
for i in range(N-1):
    if W[i][-1] != W[i+1][0]:
        bl = False
print('Yes' if bl else 'No')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
Mylog = []
cnt = 0
x = list(input())
Mylog.append(x)
for i in range(1,N):
  x = list(input())
  Mylog.append(x)
  if (x in Mylog) or (Mylog[i-1][-1] != Mylog[i][0]):
    cnt += 1
print("Yes" if cnt==0 else "No")

Failing test case input:
3
aac
cra
agc

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())
Mylog = []
cnt = 0
x = list(input())
Mylog.append(x)
for i in range(1,N):
  x = list(input())
  Mylog.append(x)
  if (x in Mylog[:-1]) or (Mylog[i-1][-1] != Mylog[i][0]):
    cnt += 1

print("Yes" if cnt==0 else "No")

Problem: p03261
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys

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

if len(set(W)) == N:
	for i in range(N-1): 
		if W[i][0] != W[i+1][-1]:
			print('No')
			sys.exit()
		else:
			print('Yes')
else:
	print('No')

Failing test case input:
3
aac
cra
agc

Expected output:
Yes


Actual output:
Yes
Yes


Fixed submission (verdict: Accepted):
import sys

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

if len(set(W)) == N:
	for i in range(N-1):
		a = W[i]
		b = W[i+1] 
		if a[-1] != b[0]:
			print('No')
			sys.exit()
	print('Yes')
else:
	print('No')
Problem: p03261
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
l = []
for i in range(n):
    w = input()
    l.append(w)
for k in range(n):
    if  l[k-1][-1] != l[k][0]:
        flag =1
        break
    for j in range(i):
        if l[k] == l[j]:
            flag = 1
            break
        
if(flag == 1):
    print('No')
else:
    print('Yes')

Failing test case input:
3
aac
cra
agc

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
l = []
flag = 0
for i in range(n):
    w = input()
    l.append(w)
for k in range(1,n):
    if  l[k-1][-1] != l[k][0]:
        flag =1
        break

    for j in range(k):
        if l[k] == l[j]:
            flag = 1
            break
        
if(flag == 1):
    print('No')
else:
    print('Yes')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

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

for i in range(1,len(W)):
  if W[i-1][-1] == W[i][0] or W[i] in W[:i]:
    print("No")
    break
else:print("Yes")

Failing test case input:
4
hoge
english
hnge
enigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())

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

for i in range(1,len(W)):
  if (W[i-1][-1] != W[i][0]) or (W[i] in W[:i]):
    print("No")
    break
else:print("Yes")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
w = [input() for i in range(n)]

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

Failing test case input:
9
b`sic
c
ocp
php
python
nadesico
ocaml
aum
assembly

Expected output:
No


Actual output:
Yes
No


Fixed submission (verdict: Accepted):
n = int(input())
w = [input() for i in range(n)]
a = 'Yes'
for i in range(n-1):
    if w.count(w[i]) > 1:
        a = 'No'
        break
    elif w[i][-1] != w[i+1][0]:
        a = 'No'
        break    
print(a)

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
a=[input() for i in range(N)]
if len(set(a))!=N:
	print("No")
	exit()
for i in range(1,N):
	if a[i-1][-1]!=a[i][0]:
		print("No")
		exit()
print("yes")		

Failing test case input:
3
aac
cra
agc

Expected output:
Yes


Actual output:
yes


Fixed submission (verdict: Accepted):
N=int(input())
a=[input() for i in range(N)]
if len(set(a))!=N:
	print("No")
	exit()
for i in range(1,N):
	if a[i-1][-1]!=a[i][0]:
		print("No")
		exit()
print("Yes")
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N = int(input())

W = []
re = 'Yes'
last = ''
for i in range(N):
    W.append(input())
    if last != '' and last != W[i][0:1]:
        re = 'No'
    elif W.count(W[i]) >= 2:
        re = 'No'
        
print(re)

Failing test case input:
8
a
aa
aaa
aaaa
aaaaa
aaa_aa
aa`
aaaaaaa

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):

N = int(input())

W = []
re = 'Yes'
last = ''
for i in range(N):
    W.append(input())
    if last != '' and last != W[i][0:1]:
        re = 'No'
    elif W.count(W[i]) >= 2:
        re = 'No'
    last = W[i][-1]
        
print(re)

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
flag = "Yes"
N = int(input())
W = input()
words = [W]
while len(words) < N:
    a = input()
    words.append(a)
    if W[-1] == a[0] and not(a in words):
        W = a
    else:
        flag = "No"

print(flag)




Failing test case input:
3
aac
cra
agc

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
flag = "Yes"
N = int(input())
W = input()
words = [W]
while len(words) < N:
    a = input()
    if W[-1] == a[0] and (a not in words):
        W = a
        words.append(a)
    else:
        flag = "No"
        words.append(a)

    

print(flag)

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=[]
for i in range(n):
    st=input()
    if st in s:
        print('No')
        exit()
    s.append(st)

for i in range(1,n-1):
    if s[i][0]!=s[i-1][-1]:
        print('No')
        exit()
print('Yes')
    

Failing test case input:
3
aac
cra
`gc

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
s=[]
for i in range(n):
    st=input()
    if st in s:
        print('No')
        exit()
    s.append(st)

for i in range(1,n):
    if s[i][0]!=s[i-1][-1]:
        print('No')
        exit()
print('Yes')

Problem: p03261
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
W = list(input() for _ in range(N))

cnt = 0
for i in range(N-1):
	first = W[i]
	next = W[i+1]
	if first[-1] == next[0]:
		cnt += 1
	else:
		cnt = cnt

if cnt == N-1:
	print('Yes')
else:
	print('No')
		

Failing test case input:
8
a
aa
aaa
aaaa
aaaaa
aaaaaa
aaa
aaaaaaa

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
import sys

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

if len(set(W)) == N:
	for i in range(N-1):
		a = W[i]
		b = W[i+1] 
		if a[-1] != b[0]:
			print('No')
			sys.exit()
	print('Yes')
else:
	print('No')
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
last = ""
flg = 0
li = []
for i in range(n):
    s = input()
    str = list(s)  
    if last == "":
        last = str[-1]
        continue

    if str[0] != last or s in li:
        flg = 1

    last = str[-1]
    li.append(s)


if flg == 0:
    print("Yes")
else:
    print("No")


Failing test case input:
4
hoge
english
hoge
enigma

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
last = ""
flg = 0
li = []
for i in range(n):
    s = input()
    str = list(s)  
    if last == "":
        last = str[-1]
        li.append(s)
        continue

    if str[0] != last or s in li:
        flg = 1

    last = str[-1]
    li.append(s)


if flg == 0:
    print("Yes")
else:
    print("No")

Problem: p03261
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
W = [input()]
flag = True
for _ in range(1, N):
    w = input()
    if not w in W and w[0] == W[-1][-1]:
        flag = False
    W.append(w)
if flag:
    print('Yes')
else:
    print('No')


Failing test case input:
3
caa
dra
`bg

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
W = [input()]
flag = True
for _ in range(1, N):
    w = input()
    if w in W or w[0] != W[-1][-1]:
        flag = False
    W.append(w)
if flag:
    print('Yes')
else:
    print('No')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

from sys import stdin
n = int(input())
W = stdin.read().splitlines()
if n != len(set(W)):
    print("No")
    exit()
for i in range(1, n-1):
    if W[i][-1] != W[i][0]:
        print("No")
        exit()


Failing test case input:
3
aac
cra
agc

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):

from sys import stdin
n = int(input())
W = stdin.read().splitlines()
if n != len(set(W)):
    print("No")
    exit()
for i in range(n-1):
    if W[i][-1] != W[i+1][0]:
        print("No")
        exit()
print("Yes")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = []
for _ in range(n):
  s = input()
  if s in l or s[0] != s[-1]:
    print('No')
    exit()
  l.append(s)
print('Yes')


Failing test case input:
3
aac
cra
agc

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
l = [input()]
for _ in range(n-1):
  s = input()
  if s in l or s[0] != l[-1][-1]:
    print('No')
    exit()
  l.append(s)
print('Yes')
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
words = [input().strip() for _ in range(N)]

def solve(words):
  s = set(words[0])
  for p, w in zip(words, words[1:]):
    if p[-1] != w[0]:
      return "No"
    if w in s:
      return "No"
    s.add(w)
  return "Yes"

print(solve(words))

Failing test case input:
4
hoge
english
hoge
enigma

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
words = [input().strip() for _ in range(N)]

def solve(words):
  s = {words[0]}
  for p, w in zip(words, words[1:]):
    if p[-1] != w[0]:
      return "No"
    if w in s:
      return "No"
    s.add(w)
  return "Yes"

print(solve(words))

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
lst = [0] * n
for i in range(n):
    lst[i] = input()

flag = True
for i in range(n-1):
    if lst[i][-1] != lst[i + 1][0]:
        flag = False

print('yes' if flag == True and len(set(lst)) == n else 'No')

Failing test case input:
4
hoge
english
hnge
emigma

Expected output:
Yes


Actual output:
yes


Fixed submission (verdict: Accepted):
n = int(input())
lst = [0] * n
for i in range(n):
    lst[i] = input()

flag = True
for i in range(n-1):
    if lst[i][-1] != lst[i + 1][0]:
        flag = False

print('Yes' if flag == True and len(set(lst)) == n else 'No')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
result = "Yes"
w = list(input())
for i in range(n - 1):
  s = input()
  if s in w:
    result = "No"
  elif s[0] != w[-1][-1]:
    result = "No"
  else:
    w.append(s)
print(result)

Failing test case input:
9
basic
c
cpp
php
python
nadesico
ocaml
lua
assembly

Expected output:
Yes

Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
result = "Yes"
w = []
s = input()
w.append(s)
for i in range(n - 1):
  s = input()
  if s in w:
    result = "No"
    break
  elif s[0] != w[-1][-1]:
    result = "No"
    break
  else:
    w.append(s)
print(result)

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

input = sys.stdin.readline

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

check = set()
flag = True
before = W[0][-1]
for i in range(1, N):
    if before != W[i][0] or W[i] in check:
        flag = False
    else:
        before = W[i][-1]
        check.add(W[i])

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



Failing test case input:
4
hoge
english
hoge
enigma

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
import sys

input = sys.stdin.readline

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

check = set([W[0]])
flag = True
before = W[0][-1]
for i in range(1, N):
    if before != W[i][0] or W[i] in check:
        flag = False
        break
    else:
        before = W[i][-1]
        check.add(W[i])

if flag:
    print('Yes')
else:
    print('No')
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = [input() for _ in range(n)]
s = set(l)
if(len(l) != len(s)):
    print('No')
    exit()
for i in range(1,n):
    if(l[i][0] != l[i][-1]):
        print('No')
        exit()
print('Yes')

Failing test case input:
4
hoge
english
hnge
enigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
l = [input() for _ in range(n)]
s = set(l)
if(len(l) != len(s)):
    print('No')
    exit()
for i in range(1,n):
    if(l[i][0] != l[i-1][-1]):
        print('No')
        exit()
print('Yes')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
sl = [input() for _ in [0]*n]
ans = 'Yes'
for i in range(1,n):
  if sl[i-1][-1] != sl[i][0]:
    ans = 'No'
print(ans)

Failing test case input:
8
a
aa
aaa
aaaa
aaaaa
aaaaaa
aaa
aaaaaaa

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
sl = [input() for _ in [0]*n]
ans = 'Yes'
for i in range(1,n):
  if sl[i-1][-1] != sl[i][0] or sl.count(sl[i]) != 1 :
    ans = 'No'
print(ans)

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = [input() for _ in range(n)]

if len(l) != len(set(l)):
    print('No')

flg = True
for i in range(len(l)-1):
    if l[i][-1] != l[i+1][0]:
        print('No')
        flg = False
        break

if flg:
    print('Yes')


Failing test case input:
8
a
aa
aaa
aaaa
aaaaa
aaa`aa
aaa
aaaaaaa

Expected output:
No


Actual output:
No
Yes


Fixed submission (verdict: Accepted):
n = int(input())
l = [input() for _ in range(n)]

flg = True
if len(l) != len(set(l)):
    flg = False


for i in range(len(l)-1):
    if l[i][-1] != l[i+1][0]:
        flg = False
        break

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

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
n = int(input())
k = []
result=[]
for i in range(n):
    a = input()
    k.append(a)
ans = collections.Counter(k)
for i in range(1,n):
    if k[i-1][-1] == k[i][0] and ans.most_common()[0][1] == 1:
        result.append("1")
    else:
        result.append("0")
print(result)
aim = collections.Counter(result)
print(aim.most_common()[0][1])
if aim.most_common()[0][1] != n-1 or aim.most_common()[0][0] =='0':
    print('No')
else:
    print('Yes')

Failing test case input:
9
basic
c
pcp
php
python
nadesico
ocaml
lua
assembly

Expected output:
No


Actual output:
['1', '0', '1', '1', '1', '1', '1', '1']
7
No


Fixed submission (verdict: Accepted):
import collections
n = int(input())
k = []
result=[]
for i in range(n):
    a = input()
    k.append(a)
ans = collections.Counter(k)
for i in range(1,n):
    if k[i-1][-1] == k[i][0] and ans.most_common()[0][1] == 1:
        result.append("1")
    else:
        result.append("0")
aim = collections.Counter(result)
if aim.most_common()[0][1] != n-1 or aim.most_common()[0][0] =='0':
    print('No')
else:
    print('Yes')