ZhenlongDai/ACPR huggingface dataset:
Problem: p03261
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
n = int(input())
w = input()
words=[]

words.append(w)

for i in range(1,n):
    w = input()
    words.append(w)
    if w not in words:
        if words[i-1][-1]==sords[i][0]:
            continue
        else:
            print("No")
            sys.exit()
    else:
        print("No")
        sys.exit()
print("Yes")

Failing test case input:
4
hoge
english
hnge
enigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
import sys
n = int(input())
w = input()
words=[]

words.append(w)

for i in range(1,n):
    w = input()
    if w not in words:
        if words[-1][-1]==w[0]:
            words.append(w)
            continue
        else:
            print("No")
            sys.exit()
    else:
        print("No")
        sys.exit()
print("Yes")

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

shi = []

for i in range(n):
	if shi.count(w[i]) == 1:
		print("No")
		exit()
	else:
		shi.append(w[i])
print("Yes")

Failing test case input:
4
fohg
fntligh
ehoh
img`ne

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
w = list(map(str,[input() for i in range(n)]))

shi = []
t = w[0][-1]
shi.append(w[0])

for i in range(1,n):
	if shi.count(w[i]) == 1:
		print("No")
		exit()
	else:
		if t == w[i][0]:
			t = w[i][-1]
			shi.append(w[i])
		else:
			print("No")
			exit()
print("Yes")

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

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

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


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

Expected output:
No


Actual output:
True
True
False
False
False
False
False
False
No


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

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

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

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=[input() for i in range(n)]
if (len(s) == len(set(s))) == 0:
  print("No")
  exit()
for c,d in zip(s[1:],s[0:]):
  if c[-1] == d[0]:
    pass
  else:
    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())
s=[input() for i in range(n)]
if (len(s) == len(set(s))) == 0:
  print("No")
  exit()
for c,d in zip(s[0:],s[1:]):

  if c[-1] == d[0]:
    pass
  else:
    print("No")
    exit()
print("Yes")
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = [input() for _ in range(N)]

if len(S) != len(set(S)):
    print("No")

next_s = ""
for s in S:
    if next_s == "":
        next_s = s[-1]
        continue
    
    if next_s != s[0]:
        print("No")
        break
    
    next_s = s[-1]
else:
    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())
S = [input() for _ in range(N)]

if len(S) != len(set(S)):
    print("No")
    
else:
    next_s = S[0][0]
    for s in S:
        if next_s != s[0]:
            print("No")
            break
        
        next_s = s[-1]
    else:
        print("Yes")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
w = []
count = 0

for i in range(n):
    w.append(input())
    
for i in range(n):
    if len(w) >= 2:
        if w[count-1][-1] == w[count][0]:
            print('No')
            exit()

        for j in range(count-1):
            if w[count] == w[j]:
                print('No')
                exit()
    count += 1

print('Yes')

Failing test case input:
3
acc
rbc
`bh

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
w = []
count = 0

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

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

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

print('Yes')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
ll = [input() for _ in range(n)]
check = 0
for i in range(len(ll)-2):
    if ll[i][len(ll[i])-1] != ll[i+1][0]:
        check = 1
    if ll[i] in ll[i+1:]:
        check = 1


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


Failing test case input:
4
ghof
fnglith
hohe
ing`me

Expected output:
No


Actual output:
Yes


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

check = 0
i = 0
for i in range(len(ll)-1):
    if ll[i] in ll[i+1:]:
        check = 1
    if ll[i][len(ll[i])-1] != ll[i+1][0]:
        check = 1

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

Problem: p03261
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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]:
        print(list_w[i])
        continue
    else:
        print("No")
        exit()
print("Yes")

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

Expected output:
No


Actual output:
a
No


Fixed submission (verdict: Accepted):
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")
        exit()
print("Yes")
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
word=[]
for i in range(n):
  if i==0:
    word.append(input())
    continue
  k=input()
  if k in word:
    print("No")
    exit()
  a=list(word[-1])
  b=list(k)
  if a[-1]==b[0]:
    pass
  else:
    print("No")
    exit()
print("Yes")

Failing test case input:
3
acb
brc
bh`

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
word=[]
for i in range(n):
  if i==0:
    word.append(input())
    continue
  k=input()
  if k in word:
    print("No")
    exit()
  a=list(word[-1])
  b=list(k)
  word.append(k)
  if a[-1]==b[0]:
    pass
  else:
    print("No")
    exit()
print("Yes")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
W = [input() for _ in range(N)]
flag = True
b = W[0][-1]
for i in range(1,N): 
  if b == W[i][0]:
    b = W[i][-1]
  else:
    flag = False
    exit()
    
if int(len(W))!=len(set(W)):
  flag = False

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

Failing test case input:
3
aac
arc
agc

Expected output:
No


Actual output:

Fixed submission (verdict: Accepted):
N = int(input())
W = [input() for _ in range(N)]
flag = True
b = W[0][-1]
for i in range(1,N): 
  if b == W[i][0]:
    b = W[i][-1]
  else:
    flag = False
    break
    
if int(len(W))!=len(set(W)):
  flag = False

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

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l = []

N = int(input())

t = input()
last = t[-1]
l.append(t)

ans = 'Yes'
for _ in range(N-1):
    t = input()
    if t[0] != last or t in l:
        ans = 'No'
print(ans)


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

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
l = []

N = int(input())

t = input()
last = t[-1]
l.append(t)

ans = 'Yes'
for _ in range(N-1):
    t = input()
    if t[0] != last or t in l:
        ans = 'No'
    l.append(t)
    last = t[-1]
print(ans)

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
count = 0
listA=[]
while (count <= N-1):
    try:
        listA.append(str(input()))
        count+=1
    except:
        break;
print(set(listA))
print(listA)
if(listA != set(listA)):
    print("No")
else:
    for i in range(N-1):
        if(listA[i][-1]!=listA[i+1][0]):
            print("No")
            break
        if(i==N-2):
            print("Yes")

Failing test case input:
4
ghof
englith
hnge
ingame

Expected output:
No


Actual output:
{'hnge', 'ghof', 'ingame', 'englith'}
['ghof', 'englith', 'hnge', 'ingame']
No


Fixed submission (verdict: Accepted):
N=int(input())
count = 0
listA=[]
while (count <= N-1):
    try:
        listA.append(str(input()))
        count+=1
    except:
        break;
if(len(listA) != len(set(listA))):
    print("No")
else:
    for i in range(N-1):
        if(listA[i][-1]!=listA[i+1][0]):
            print("No")
            break
        if(i==N-2):
            print("Yes")
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
n=int(input())
now=input()
for i in range(n-1):
    w=input()
    if now[-1]!=w[0]:
        print("No")
        sys.exit()
    now=w
print("Yes")

Failing test case input:
4
hoge
english
hoge
enigma

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
import sys
n=int(input())
now=input()
D=[now]
for i in range(n-1):
    w=input()
    if now[-1]!=w[0] or w in D:
        print("No")
        sys.exit()
    D.append(w) 
    now=w
print("Yes")

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

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

def alg1(W):
  list = []
  point = W[0]
  for i in range(1,N):
    if W[i] not in list and W[i][0] == point[-1]:
      list.append(W[i])
      point = W[i]
      pass
    else:
      return 'No'
  return 'Yes'

print(alg1(W))

Failing test case input:
4
hoge
english
hoge
enigma

Expected output:
No

Actual output:
Yes


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

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

def alg1(W):
  list = [W[0],]
  point = W[0]
  for i in range(1,N):
    if W[i] not in list and W[i][0] == point[-1]:
      list.append(W[i])
      point = W[i]
    else:
      return 'No'
  return 'Yes'

print(alg1(W))

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

Word = [W[0]]
for i in range(2,n):
    s = W[i-1]
    t = W[i]
    
    if(s[-1] != t[0] or t in Word): 
        flg = 0
        break
    Word.append(t)
    
if (flg): print("Yes")
else: print("No")



Failing test case input:
4
egoh
english
hnge
emigma

Expected output:
No


Actual output:
Yes


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

Word = [W[0]]
for i in range(1,n):
    s = W[i-1]
    t = W[i]
    
    if(s[-1] != t[0] or t in Word): 
        flg = 0
        break
    Word.append(t)
    
if (flg): print("Yes")
else: print("No")

Problem: p03261
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
out = "Yes"
S = input()
L = []

L.append(S)
for i in range(N-1):
    T = input()
    if T in L:
        out = "No"
    if T[0]!=S[-1]:
        out = "No"
    S = T
print(out)


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())
out = "Yes"
S = input()
L = []

L.append(S)
for i in range(N-1):
    T = input()
    if T in L:
        out = "No"
    if T[0]!=S[-1]:
        out = "No"
    S = T
    L.append(S)
print(out)
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
w = [input() for _ in range(n)]

correct = True
end = w[0][-1]
for i in range(1, len(w)):
    word = w[i]
    if word in w[i + 1:]:
        correct = False
        break
    start = word[0]
    if start != end:
        correct = False
        break
    end = word[-1]

if correct:
    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())
w = [input() for _ in range(n)]

correct = True
for i in range(len(w)):
    if w[i] in w[i + 1:]:
        correct = False
        break
    if i > 0 and w[i][0] != w[i - 1][-1]:
        correct = False
        break

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

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
N = int(input())
k = input()
a = []
for i in range(N-1):
    a.append(input())
lis = []
for words in a:
  if words in lis:
    print('No')
    sys.exit()
  elif k[-1] != words[0]:
    print('No')
    sys.exit()
  else:
    lis.append(words)
    k = words
print('Yes')

Failing test case input:
4
hoge
english
hoge
enigma

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
import sys
N = int(input())
k = input()
a = []
for i in range(N-1):
    a.append(input())
lis = [k]
for words in a:
  if words in lis:
    print('No')
    sys.exit()
  elif k[-1] != words[0]:
    print('No')
    sys.exit()
  else:
    lis.append(words)
    k = words
print('Yes')

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)>=2:
        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())
B=[]
S = 0
for i in range(0,n):
    B.append((input()))
for m in range(n-1):
    if B[m][-1] == B[m+1][0]:
        S += 1
if S == n-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())
B=[]
S = 0
for i in range(0,n):
    B.append((input()))
C = set(B)
if len(B) != len(C):
    print("No")
else:
    for m in range(n-1):
        if B[m][-1] == B[m+1][0]:
            S += 1
    if S == n-1:
        print("Yes")
    else: 
        print("No")
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
w = []
count = 0

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

for i in range(n):
    if len(w) >= 2:
        print(w[count-1][-1] , w[count][0])
        if w[count-1][-1] != w[count][0]:
            print('No')
            exit()

        for j in range(count-1):
            if w[count] == w[j]:
                print('No')
                exit()
    count += 1

print('Yes')

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

Expected output:
No


Actual output:
a `
No


Fixed submission (verdict: Accepted):
n = int(input())
w = []
count = 0

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

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

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

print('Yes')

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

if len(S) != len(set(S)):
    print("No")

next_s = S[0][0]
for s in S:
    if next_s != s[0]:
        print("No")
        break
    
    next_s = s[-1]
else:
    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())
S = [input() for _ in range(N)]

if len(S) != len(set(S)):
    print("No")
    
else:
    next_s = S[0][0]
    for s in S:
        if next_s != s[0]:
            print("No")
            break
        
        next_s = s[-1]
    else:
        print("Yes")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
n=int(input())
word=[]
j=0
word.append('aaaaaaaaaaaa')
for i in range(1,n+1):
    word.append(input())
while j<=n:
    if word[j]==word[i]:
        print('No')
        sys.exit()
    elif word[i-1][len(word[i-1])-1]!=word[i][0]:
        print('No')
        sys.exit()
    else:
        j+=1

print('Yes')

Failing test case input:
3
aac
cra
agc

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
import sys
n=int(input())
word=[]
word.append('０')
for i in range(1,n+1):
    word.append(input())
    for j in range(0,i):
        if word[j]==word[i]:
            print('No')
            sys.exit()
        else:
            j+=1
    if (i>1)& (word[i-1][len(word[i-1])-1]!=word[i][0]):
        print('No')
        sys.exit()

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


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

if len(w)!=len(set(w)):
    print("No")
else:
    prev=w[0]
    for i in range(1,n-1):
        cur=w[i]
        if prev[-1]!=cur[0]:
            print("No")
            break
        prev=cur
    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() for _ in range(n)]

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

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
used=[]
used.append(input())
chain=used[0][-1]
res="Yes"
for i in range(n-1):
    print(used)
    s=input()
    c=s[0]
    print(chain)
    if s in used or chain!=c:
        res="No"
        break
    used.append(s)
    chain=s[-1]
    


Failing test case input:
9
b`sic
c
ncp
qgp
ptyhon
nadftico
ocaml
aum
aasemsly

Expected output:
No


Actual output:
['b`sic']
c
['b`sic', 'c']
c


Fixed submission (verdict: Accepted):
n=int(input())
used=[]
used.append(input())
chain=used[0][-1]
res="Yes"
for i in range(n-1):
    s=input()
    c=s[0]
    if s in used or chain!=c:
        res="No"
        break
    used.append(s)
    chain=s[-1]
    

print(res)

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:
    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):

n=int(input())
data=[]
check=True
data.append(input())
for i in range(n-1):
  data.append(input())
  for j in range(i):
    if(data[i]==data[j]):
      check=False
  if(data[i-1][len(data[i-1])-1]!=data[i][0]):
    check=False
if(check==False):
  print("No")
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())
data=[]
check=True
data.append(input())
for i in range(1,n):
  data.append(input())
  for j in range(i):
    if(data[i]==data[j]):
      check=False
  if(data[i-1][len(data[i-1])-1]!=data[i][0]):
    check=False
if(check==False):
  print("No")
else:
  print("Yes")
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
W = [input() for i in range(N)]
s_W = list(set(W))

if len(W) != len(s_W):
    print('No')
    exit()

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

Failing test case input:
3
acb
brc
bh`

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
W = [input() for i in range(N)]
s_W = list(set(W))

if len(W) != len(s_W):
    print('No')
    exit()

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

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

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

Failing test case input:
4
hoge
english
hnge
enigma

Expected output:
Yes


Actual output:

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

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

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
list = []
for i in range(n):
    a = input()
    list.append(a)
def is_unique(seq):
    return len(seq) == len(set(seq))

if is_unique(list) == False:
    print('No')

else:
    for k in range(n-1):
        a = list[k]
        b = list[k + 1]
        if a[-1] == b[0]:
            pass
        else:
            print('No')
            break
    print('Yes')


Failing test case input:
8
a
_`
`aa
aaaa
a``a`
ba_aaa
ba`
aaaaaaa

Expected output:
No


Actual output:
No
Yes


Fixed submission (verdict: Accepted):
n = int(input())
list = []
for i in range(n):
    a = input()
    list.append(a)
def is_unique(seq):
    return len(seq) == len(set(seq))

if is_unique(list) == False:
    print('No')

else:
    s = 0
    for k in range(n-1):
        a = list[k]
        b = list[k + 1]
        if a[-1] == b[0]:
            s += 1
        else:
            print('No')
            break
    if (s+1) == n:
        print('Yes')
    else:
        pass
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
string_list = [input() for i  in range(n)]

def shiritori(n, string_list):

    if len(string_list)!=len(set(string_list)):
        return False

    for i in range(1,n-1):
        if string_list[i-1][-1]!=string_list[i][0]:
            print(string_list[i-1][-1],string_list[i][0])
            return False

    return True

def main():


    if shiritori(n, string_list):
        print('Yes')
    else :
        print('No')

if __name__=='__main__':
    main()


Failing test case input:
3
aca
brc
bh`

Expected output:
No


Actual output:
a b
No


Fixed submission (verdict: Accepted):
def shiritori(n, string_list):

    if len(string_list)!=len(set(string_list)):
        return False

    for i in range(1,n):
        if string_list[i-1][-1]!=string_list[i][0]:
            return False

    return True


def main():
    n = int(input())
    string_list = [input() for i  in range(n)]

    if shiritori(n, string_list):
        print('Yes')
    else :
        print('No')

if __name__=='__main__':
    main()

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

def main():
    ed = []
    for i in range(int(a)-1):
        neww = input()
        if i != 0:
            if ed[i-1][-1] != neww[0] or neww in ed:
                return 'No'
        ed.append(neww)

    return 'Yes'
                

if __name__ == '__main__':
    print(main())



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

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
a = input()

def main():
    ed = []
    for i in range(int(a)):
        neww = input()
        if i != 0:
            if ed[i-1][-1] != neww[0] or neww in ed:
                return 'No'
        ed.append(neww)

    return 'Yes'
                

if __name__ == '__main__':
    print(main())

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

N = int(input())

strList = [""] * N
strList[0] =input()
ans = "Yes"

for count in range(1,N):
    string = input()
    for s in strList:
        if s == string :
            ans = "No"
            break
        else:
            before = strList[count -1]
            car = before[len(before) -1: len(before)] 
            if car != string[:1]:
                ans = "No"
                break
    if ans == "No":
        break
    strList.append(string)

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())

strList = [""] * N
strList[0] =input()
ans = "Yes"

for count in range(1,N):
    string = input()
    for s in strList:
        if s == string :
            ans = "No"
            break
        else:
            before = strList[count -1]
            car = before[len(before) -1: len(before)] 
            if car != string[:1]:
                ans = "No"
                break
    if ans == "No":
        break
    strList[count] = string

print(ans)
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy
n = int(input())

word = [input() for _ in range(n)]
word2 = copy.deepcopy(word)
word2.append("pogyaaaaaaaaaaaaaaaaaaa")
flag = 0


for index, q in enumerate(word):
    for index2, w in enumerate(word):
        if index == index2:
            continue
        
        if q == w:
            flag += 1
        break
            

i = 0
for i in range(n-1):
    if word[i][-1] == word2[i+1][0]:
        flag += 0
    else:
        flag += 1

if flag != 0:
    print("No")
else:
    print("Yes")


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

Expected output:
No

Actual output:
Yes


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

word = [input() for _ in range(n)]
word2 = copy.deepcopy(word)
word2.append("koredeiinokasira...tukareta")
flag = 0


for index, q in enumerate(word):
    for index2, w in enumerate(word):
        
        
        if q == w:
            if index == index2:
                continue
            flag += 1
        
            

i = 0
for i in range(n-1):
    if word[i][-1] == word2[i+1][0]:
        flag += 0
    else:
        flag += 1


if flag != 0:
    print("No")
else:
    print("Yes")

Problem: p03261
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
a=[]
for n in range(n):
  a.append(input())

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

Failing test case input:
4
ghof
fntligh
hohe
img`ne

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
a=[]
for i in range(n):
  a.append(input())

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

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=set()
flag=True
for i in range(n):
    buf=""
    str=input()
    if buf!="" and str[0]!=buf[-1:]:
        flag=False
    if str in s:
        flag=False
    s.add(str)
    buf=str
    print(buf[-1:])

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


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

Expected output:
No


Actual output:
a
`
`
a
a
a
a
`
Yes


Fixed submission (verdict: Accepted):
n=int(input())
s=set()
flag=True
buf=""
for i in range(n):
    str=input()
    if buf!="" and str[0]!=buf[-1:]:
        flag=False
    if str in s:
        flag=False
    s.add(str)
    buf=str

if flag:
    print("Yes")
else:
    print("No")
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
x=[input() for _ in range(N)]
flag=0

if len(x)!=len(list(set(x))):
  flag=1
  
for i in range(N):
  if x[i][-1]!=x[i][0]:
    flag=1
if flag==0:
  print("Yes")
else:
  print("No")

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())
x=[input() for _ in range(N)]
flag=0

if len(x)!=len(list(set(x))):
  flag=1

for i in range(N-1):
  if x[i][-1]!=x[i+1][0]:
    flag=1
if flag==0:
  print("Yes")
else:
  print("No")

Problem: p03261
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
s=input()
ans=0
for i in range(n-1):
  keep=s[-1]
  s=input()
  if keep != s[0]:
    ans=1
  else:
    continue
print(["Yes","No"][ans])
    
  


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())
check=[]
s=input()
check.append(s)
ans=0
for i in range(n-1):
  keep=s[-1]
  s=input()
  if keep != s[0]:
    ans=1
  if str(s) in check:
    ans = 1
  else:
    check.append(s)
print(["Yes","No"][ans])

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

Failing test case input:
4
hoge
english
hoge
enigma

Expected output:
No

Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
S=[input() for _ in range(n)]
ans=1
for i in range(n-1):
    if (S[i][-1] == S[i+1][0])*(S[i+1] not in S[:i+1]):
        ans += 1
print("Yes" if ans == n else "No")

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


n = int(input())
words = [0]*n
for i in range(n):
    words[i] = str(input())

state = 1

for i in range(n-1):
    
    if list(words[i])[-1] == list(words[i+1])[0]:
        state = 1
    else:
        state = 0

if len(list(set(words))) < n:
    state = 0


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

Failing test case input:
4
hgof
english
hnge
emigma

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):


n = int(input())
words = [0]*n
for i in range(n):
    words[i] = str(input())

state = 1

for i in range(n-1):
    
    if list(words[i])[-1] == list(words[i+1])[0]:
        state = 1
    else:
        state = 0
        break

if len(list(set(words))) < n:
    state = 0

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

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
b=input()
d={b}
f=1
for _ in [0]*~-N:s=input();f=b[-1]==s[0]and s not in d;b=s;d|={s}
print('Yes'if f else'No', d)

Failing test case input:
8
a
_`
`aa
aaaa
a``a`
ba_aaa
ba`
aaaaaaa

Expected output:
No


Actual output:
No {'_`', '`aa', 'a``a`', 'a', 'aaaaaaa', 'ba`', 'ba_aaa', 'aaaa'}


Fixed submission (verdict: Accepted):
N=int(input())
b=input()
d={b}
f=1
for _ in [0]*~-N:
  s=input()
  if b[-1]!=s[0]or s in d:f=0;break
  b=s;d|={s}
print('Yes'if f else'No')
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
list = []
for i in range(n):
    a = input()
    list.append(a)
def is_unique(seq):
    return len(seq) == len(set(seq))

if is_unique(a) == False:
    print('No')

else:
    for k in range(n-1):
        a = list[k]
        b = list[k + 1]
        if a[-1] == b[0]:
            pass
        else:
            print('No')
            break
    print('Yes')


Failing test case input:
3
acc
brc
hb`

Expected output:
No


Actual output:
No
Yes


Fixed submission (verdict: Accepted):
n = int(input())
list = []
for i in range(n):
    a = input()
    list.append(a)
def is_unique(seq):
    return len(seq) == len(set(seq))

if is_unique(list) == False:
    print('No')

else:
    s = 0
    for k in range(n-1):
        a = list[k]
        b = list[k + 1]
        if a[-1] == b[0]:
            s += 1
        else:
            print('No')
            break
    if (s+1) == n:
        print('Yes')
    else:
        pass

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


if __name__ == "__main__":
    n = int(input())
    w = []
    flag = True
    for _ in range(n):
        a = input()
        if len(w) == 0:
            continue
        last = w[len(w)-1]
        if a[0] != last[len(last)-1] or a in w:
            flag = False
            print("No")
            break
        w.append(a)
    if flag == True:
        print("Yes")



Failing test case input:
4
fgoh
english
hnge
emigma

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):


if __name__ == "__main__":
    n = int(input())
    w = []
    flag = True
    for _ in range(n):
        a = input()
        if len(w) == 0:
            w.append(a)
            continue
        last = w[len(w)-1]
        if a[0] != last[len(last)-1] or a in w:
            flag = False
            break
        w.append(a)
    if flag == True:
        print("Yes")
    else:
        print("No")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
 
n = int(input())
l = []
p = None
 
for i in range(n):
  s = input()
  if s in l and (p == None or p[-1:] == s[1:]):
    l.append(s)
    p = s
  else:
    print("No")
    sys.exit()
print("Yes")

Failing test case input:
3
aac
cra
agc

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
import sys
 
n = int(input())
l = []
p = None
 
for i in range(n):
  s = input()
  if s not in l and (p == None or p[-1:] == s[:1]):
    l.append(s)
    p = s
  else:
    print("No")
    sys.exit()
print("Yes")
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,w,temp = int(input()),[],[]
for i in range(n):
    w.append(input())
    if w[-1] in temp:
        print("No")
        exit()
    else:
        temp.append(w[-1])
    if i>0 and w[i-1][0] != w[i][-1]:
        print("No")
        exit()
print("Yes")

Failing test case input:
4
hoge
english
hnge
emigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n,w,temp = int(input()),[],[]
for i in range(n):
    w.append(input())
    if w[-1] in temp:
        print("No")
        exit()
    else:
        temp.append(w[-1])
    if i>0 and w[i-1][-1] != w[i][0]:
        print("No")
        exit()
print("Yes")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
S=[input() for _ in range(n)]
ans=0
for i in range(n-1):
    if S[i][-1] != S[i+1][0]:
        ans = 1
        break
print("Yes" if ans == 0 else "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())
S=[input() for _ in range(n)]
ans=1
for i in range(n-1):
    if (S[i][-1] == S[i+1][0])*(S[i+1] not in S[:i+1]):
        ans += 1
print("Yes" if ans == n else "No")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
W=[]
for i in range(n):
    w=input()
    W.append(w)
    if i > 0:
        if W[0] == last and str(W).count(W[i]) <= 1:
            ans=1
        else:
            ans=0
            break
    last = W[len(W)-1]
if ans==0:
    print("No")
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())
W=[]
for i in range(n):
    w=input()
    W.append(w)
    if i > 0:
        if W[i][0] == last and W.count(W[i]) <= 1:
            ans=1
        else:
            ans=0
            break
    last = W[i][len(W[i])-1]
if ans==0:
    print("No")
else:
    print("Yes")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
w = [input() for i in range(n)]
ok = True
if len(w) != len(set(w)):
  for i in range(n-1):
    if w[i][-1] != [i][0]:
      ok = False
  if ok:
    print("Yes")
  else:
    print("No")
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())
w = [input() for i in range(n)]
if len(w) == len(set(w)):
  ok = True
  for i in range(n-1):
    if w[i][-1] != w[i+1][0]:
      ok = False
      break
  if ok:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s2=list(input())
k = 0
w = []
r = ''
for i in range(len(s2)):
    r += s2[i]
w.append(r)
for i in range(1,n):
    s=list(input())
    if s[0]!=s2[len(s2)-1]:
        k = 2
    r = ''
    for j in range(len(s)):
        r += s[j]
    
    if w.count(r) != 0:
        k = 1
    w.append(r)
    s2 = s
if k == 1:
    print('No')
else:
    print('Yes')

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

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
s2=list(input())
k = 0
w = []
r = ''
for i in range(len(s2)):
    r += s2[i]
w.append(r)
for i in range(1,n):
    s=list(input())
    if s[0]!=s2[len(s2)-1]:
        k = 1
    r = ''
    for j in range(len(s)):
        r += s[j]
    
    if w.count(r) != 0:
        k = 1
    w.append(r)
    s2 = s
if k == 1:
    print('No')
else:
    print('Yes')

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
n = int (input())
words = []
for i in range (n) :
    words.append(input())
for x in range(len(words)-1):
    if words.count(words[x]) > 1 or words[x+1][0] != words[x][-1]:
        print("No")
        sys.exit()
    else:
        "Yes"

Failing test case input:
4
hoge
english
hnge
enigma

Expected output:
Yes


Actual output:

Fixed submission (verdict: Accepted):
import sys
n = int (input())
words = []
No=" "
for i in range (n) :
    words.append(input())
for x in range(len(words)-1):
    if words.count(words[x]) > 1 or words[x+1][0] != words[x][-1]:
        No="No"
        print (No)
        sys.exit() 
if No != "No":
     print ("Yes")

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
n=int(input())
word=[]
j=0
word.append('aaaaaaaaaaaa')
for i in range(1,n+1):
    word.append(input())
while j<=n:
    if word[j]==word[i]:
            print('No')
            sys.exit()
    elif word[i-1][len(word[i-1])-1]!=word[i][0]:
        print('No')
        sys.exit()
    else:
        j+=1

print('Yes')

Failing test case input:
4
hoge
english
hnge
emigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
import sys
n=int(input())
word=[]
word.append('０')
for i in range(1,n+1):
    word.append(input())
    for j in range(0,i):
        if word[j]==word[i]:
            print('No')
            sys.exit()
        else:
            j+=1
    if (i>1)& (word[i-1][len(word[i-1])-1]!=word[i][0]):
        print('No')
        sys.exit()

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


def check(words):
    answer = "Yes"
    for i in range(0, len(words)):
        for j in range(i, len(words)):
            if(words[i] == words[j]):
                answer = "No"

    return answer


def main(words):
    answer = check(words)
    print(answer)


if __name__ == "__main__":
    num = int(input())  
    str = [input() for i in range(0, num)]  
    main(str)

Failing test case input:
4
hoge
english
hnge
emigma

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):


def check(words):
    answer = "Yes"

    
    for i in range(0, len(words)):
        for j in range(i+1, len(words)):
            if(words[i] == words[j]):
                answer = "No"

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

    return answer


def main(words):
    answer = check(words)
    print(answer)


if __name__ == "__main__":
    num = int(input())  
    str = [input() for i in range(0, num)]  
    main(str)

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
W = []
f = True
for i in range(N):
  W.append(input())
for i in range(N):
  if W[i][0] != W[i][-1]:
    f = False
W = sorted(W)
for i in range(N-1):
  if W[i] == W[i+1]:
    f = False
if f:
  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())
W = []
f = True
for i in range(N):
  W.append(input())
for i in range(N-1):
  if W[i][-1] != W[i+1][0]:
    f = False
W = sorted(W)
for i in range(N-1):
  if W[i] == W[i+1]:
    f = False
if f:
  print("Yes")
else:
  print("No")

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


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

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
w=[]
for i in range(n):
    w.append(input())
result=True
for i in range(1,n):
    if w[i] in w[0:i]:
        result=False
    else:
        first=w[i]
        second=w[i-1]
        if first[0]!=second[-1]:
            result=False
if result==False:
    print("No")
else:
    print("Yes")
Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
List=list(input() for i in range(N))
count=0
if len(set(List))!=len(List):
  print("No")
 
else:
  
  for i in range(N-1):
    if List[i][-1]!=List[i+1][0]:
      count+=1
  if count==0:
    print("Yes")
  else:
    print("NO")

Failing test case input:
3
caa
cra
bh`

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
N=int(input())
List=list(input() for i in range(N))

if len(set(List))!=len(List):
  print("No")

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

Problem: p03261
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
li=[]
for i in range(0,n):
    n=input()
    li.append(n)
flag=0
chck=1
temp=li[0]
for j in li:
    t=li.count(j)
    if(t>1):
        flag=1
        break
    if(chck!=1):
        p=len(temp)
        ch=temp[p-1]
        
        ch1=j[0]
        if(ch==ch1):
            flag=0
            temp=j
        else:
            flag=1
            break
    chck=chck+1
if(flag==1):
    print('NO')
else:
    print('YES')

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

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
n=int(input())
li=[]
for i in range(0,n):
    n=input()
    li.append(n)
flag=0
chck=1
temp=li[0]
for j in li:
    t=li.count(j)
    if(t>1):
        flag=1
        break
    if(chck!=1):
        p=len(temp)
        ch=temp[p-1]
        
        ch1=j[0]
        if(ch==ch1):
            flag=0
            temp=j
        else:
            flag=1
            break
    chck=chck+1
if(flag==1):
    print('No')
else:
    print('Yes')

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

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

cnt = 0
if len(set(W)) == len(W):
	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:
8
`
a`
aaa
aaaa
`aaaa
aaa_aa
aa`
aaaaaaa

Expected output:
No


Actual output:
Yes
Yes
Yes
Yes
No


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())
W = list(input() for _ in range(N))

cnt = 0
if len(set(W)) == len(W):
	for i in range(N-1): 
		if W[i][0] == W[i+1][-1]:
			cnt += 1
		else:
			cnt = cnt
else:
	print('No')

if cnt == N-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):
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())
shiritori_list = []
shiritori_list.append(str(input()))
bool = True

for i in range(N-1):
    tmp = str(input())
    shiritori_list.append(tmp)
    if shiritori_list[i][-1] != tmp[0]:
        bool = False
    else:
        if tmp in shiritori_list:
            bool = False

if bool:
    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())
list = []
bool = True

for i in range(N):
    list.append(input())
if len(set(list)) != len(list):
    bool = False
else:
    for i in range(N - 1):
        if list[i][-1] != list[i+1][0]:
            bool = False

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

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

n=int(input())
list=[]
word=input()
list+=word
key=word[-1]
for i in range(1,n):
    word=input()
    if key==word[0] and word not in list:
        list+=word
        key=word[-1]
    else:
        print("No")
print("Yes")


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

Expected output:
No


Actual output:
No
No
No
No
No
No
No
No
Yes


Fixed submission (verdict: Accepted):
n=int(input())
list=[]
word=input()
list.append(word)
key=word[-1]
flag=True
for i in range(1,n):
    word=input()
    if key==word[0] and (word not in list):
        list.append(word)
        key=word[-1]
    else:
        print("No")
        flag=False
        break
if flag:
    print("Yes")

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

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

tmp=set(words)
print(tmp)
c=1
if len(words)!=len(tmp):
    c=0
else:
    for i in range(N):
        print(words)
        if i==0:
            continue
        elif words[i][0]!=words[i-1][-1]:
            c=0
            break


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

Failing test case input:
3
aac
cra
`gc

Expected output:
No


Actual output:
{'`gc', 'aac', 'cra'}
['aac', 'cra', '`gc']
['aac', 'cra', '`gc']
['aac', 'cra', '`gc']
0
No


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

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

tmp=set(words)

c=1
if len(words)!=len(tmp):
    c=0
else:
    for i in range(N):

        if i==0:
            continue
        elif words[i][0]!=words[i-1][-1]:
            c=0
            break



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