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

Submission attempts (in order):
n,w=int(input()),[input()for i in range(n)]
def sortex(X):
  b=sorted(X)
  b.append("null")
  a=[]
  for i in range(len(X)):
    if b[i]!=b[i+1]:a.append(b[i])
  return a
if len(w)!=len(sortex(w)):
  print("No")
  exit()
for i in range(len(w)-1):
  if w[i][-1]!=w[i+1][0]:
    print("No")
    exit()
print("Yes")

n=int(input())
w=input()
s={w}
for i in range(n-1):
  ww=input()
  if w[-1]!=ww[0] or ww in s:print("No");exit()
  w=ww
  s.add(w)
print("Yes")

Verdicts: Runtime Error

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

Submission attempts (in order):
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]
    


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]
    


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)


Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
N = int(input())
W = list(input())
a = 'Yes'

s = W[0]

for i in range(N-1):
    k = input()
    if s[-1]==k[0] and k not in W:
        W.append(k)
        s = W[-1]
    else:
        a = 'No'
        for j in range(N-i):
            k = input()
        break


print(a)

N = int(input())
W =[ input()]
a = 'Yes'

for i in range(1,N):
    k = input()
    W.append(k)
    if W[-2][-1]!=k[0] or len(set(W))!=(i+1):
        a = 'No'
        break

print(a)

Verdicts: Runtime Error

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

Submission attempts (in order):
n = int(input())
l= [input() for elt in range(n)]
x =0
for elt in range(len(l)):
    if l.count(l[elt]) > 1 :

        x=1
        break
for elt in range (len(l )-1):
    if l[elt][-1] != l[elt+1][0]:

        x = 1
        break
if x == 0:
    print("YES")
else:
    print("NO")



n = int(input())
l= [input() for elt in range(n)]
x =0
for elt in range(len(l)):
    if l.count(l[elt]) != 1 :

        x=1
        break
for elt in range (len(l )-1):
    if l[elt][-1] != l[elt+1][0]:

        x = 1
        break
if x == 0:
    print("YES")
else:
    print("NO")


n = int(input())
l= []
x = 0
for elt in range(n):
    inp = input()
    l.append(inp)
for elt in range(len(l)):
    if l.count(l[elt]) > 1 :
        print("NO")
        x+=1
        break

    else:
        if elt < len(l)-1:
            if l[elt][-1] != l[elt+1][0]:
                print("NO")
                x += 1
                break
if x == 0:
    print("YES")





n = int(input())
l= []
x = 0
for elt in range(n):
    inp = input()
    l.append(inp)
for elt in range(len(l)):
    if l.count(l[elt]) > 1 :
        print("No")
        x+=1
        break

    else:
        if elt < len(l)-1:
            if l[elt][-1] != l[elt+1][0]:
                print("No")
                x += 1
                break
if x == 0:
    print("Yes")





Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
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')

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

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

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

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

print('Yes')

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

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
N = int(input())
ary = []
s = 'Yes'
for i in range(N):
  w = input()
  if w in ary:
    s = 'No'
    break
  if len(ary) > 0 and w[0] != ary[-1][-1]:
    s = 'No'
    break
    
print(s)

N = int(input())
ary = []
s = 'Yes'
for i in range(N):
  w = input()
  if w in ary:
    s = 'No'
    break
  if len(ary) > 0 and w[0] != ary[-1][-1]:
    s = 'No'
    break
  ary.append(w)
    
print(s)

Verdicts: Wrong Answer

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

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

n = input()
n = int(n)

w = []
for i in range(n):
    _w = input()
    w.append(_w)
ans = "YES"
for i in range(0,len(w)-1):
    for j in range(i+1,len(w)):
        if w[i] == w[j]:
            ans = "NO"
for i in range(0,len(w)-1):
    if w[i][-1] != w[i+1][0] :
        ans ="NO"

print(ans)

9
basic
c
cpp
php
python
nadesico
ocaml
lua
assembly

# -*- coding:utf-8 -*-

n = input()
n = int(n)

w = []
for i in range(n):
    _w = input()
    w.append(_w)
ans = "YES"
for i in range(0,len(w)-1):
    for j in range(i+1,len(w)):
        if w[i] == w[j]:
            ans = "NO"
for i in range(0,len(w)-1):
    if w[i][-1] != w[i+1][0] :
        ans ="NO"

print(ans)

# -*- coding:utf-8 -*-

n = input()
n = int(n)

w = []
for i in range(n):
    _w = input()
    w.append(_w)
ans = "Yes"
for i in range(0,len(w)-1):
    for j in range(i+1,len(w)):
        if w[i] == w[j]:
            ans = "No"
for i in range(0,len(w)-1):
    if w[i][-1] != w[i+1][0] :
        ans ="No"

print(ans)

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

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

Submission attempts (in order):

#                         created: 2019-11-10 12:28:14(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n, *w = sys.stdin.read().split()
    n = int(n)
    for i in range(1, n):
        if w[i][0] == w[i-1][-1] and not w[i] in w[:i]:
            continue
        else:
            sys.exit('No')
    
    print('Yes')


if __name__ == "__main__":
    # execute only if run as a script
    main()


import sys

n, *words = sys.stdin.read().split()
n = int(n)

def main():
    announced = set()
    last = words[0][0]
    for w in words:
        if w in announced:
            return 'No'
        elif w[0] != last:
            return 'No'
        announced.add(w)
        last = w[-1]
    return 'Yes'

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

Verdicts: Runtime Error

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

Submission attempts (in order):
n = int(input())
w = [input() for i in range(n)]

s = set(w[0])
word = w[0][-1]

for i in range(1, n):
    if w[i] in s:
        print("No")
        exit()
    if w[i][0] != word:
        print("No")
        exit()
    s.add(w[i])
    word = w[i][-1]

print("Yes")

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

s = set([])
s.add(w[0])
word = w[0][-1]

for i in range(1, n):
    if w[i] in s:
        print("No")
        exit()
    if w[i][0] != word:
        print("No")
        exit()
    s.add(w[i])
    word = w[i][-1]

print("Yes")

Verdicts: Wrong Answer

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

Submission attempts (in order):
N = input()
w = []
for i in range(N):
    w.append(input())
# [a1, a2, a3, ..., aN]
p = 0
for i in range(N):
  for j in range(i+1,N):
    if w[i] == w[j]:
      p = 1
      break
    
v = []
for j in range(N):
  v[j] = list(w[j])

for k in range(N):
  if k != 0:
    if v[k - 1][len(v[k - 1]) - 1] != v[k][0]:
      p = 1
      break

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


N = input()
w = []
for i in range(N):
    w.append(input())
# [a1, a2, a3, ..., aN]
p = 0
for i in range(N):
  for j in range(i+1,N):
    if w[i] == w[j]:
      p = 1
      break
    
v = []
for j in range(N):
  v[j] = list(w[j])

for k in range(N):
  if k != 0:
    if v[k - 1][len(v[k - 1]) - 1] != v[k][0]:
      p = 1
      break

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

N = int(input())
w = []
for i in range(N):
    w.append(input())
# [a1, a2, a3, ..., aN]
p = 0
for i in range(N):
  for j in range(i+1,N):
    if w[i] == w[j]:
      p = 1
      break
v = []
    
for i in range(N):
  v.append([])

for j in range(N):
  for s in list(w[j]):
    v[j].append(s)

for k in range(N):
  if k != 0:
    if v[k - 1][len(v[k - 1]) - 1] != v[k][0]:
      p = 1
      break

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

Verdicts: Runtime Error

Runtime Error

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

Submission attempts (in order):
N = int(input())
W = [input() for _ in range(N)]

a = []
pre = W[0]
flag = False
for wi in W[1:]:
    if wi in a or pre[-1] != wi[0]:
        flag = True
        break
    pre = wi
    a.append(wi)
        
if flag:
    print('No')
else:
    print('Yes')

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

a = []
pre = W[0]
a.append(pre)
flag = False
for wi in W[1:]:
    if wi in a or pre[-1] != wi[0]:
        flag = True
        break
    pre = wi
    a.append(wi)
        
if flag:
    print('No')
else:
    print('Yes')

Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input())
l = []
e = ["_"]
ans = "Yes"
for i in range(n):
  w = input()
  if w[-1] in e or w in l : ans = "No" 
  l.append(i)
  e[0] = w[-1]
print(ans)

n = int(input())
l = []
e = "abcdefghijklmnopqrstuvwxyz"
ans = "Yes"
for i in range(n):
  w = input()
  if w[0] not in e or w in l : ans = "No" 
  l.append(w)
  e = w[-1]
print(ans)

Verdicts: Wrong Answer

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

Submission attempts (in order):
from colecctions import defaultdict

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

dic = defaultdict(int)

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

from collections import defaultdict
 
N = int(input())
W = [input().strip() for _ in range(N)]
 
dic = defaultdict(int)
 
for i in range(N):
  if i == 0:
    tmp = W[i][-1]
    dic[W[i]] += 1
  else:
    if tmp != W[i][0] or dic[W[i]]:
      print("No")
      break
    else:
      dic[W[i]] += 1
      tmp = W[i][-1]
else:
  print("Yes")

Verdicts: Runtime Error

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

Submission attempts (in order):
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(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")

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

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

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
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
if flag:
    print("Yes")


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



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 in list:
        list+=word
        key=word[-1]
    else:
        print("No")
print("Yes")



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



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



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


n=int(input())
list=[]
word=input()
list.append(word)
key=word[-1]
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")
print("Yes")


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


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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
N=int(input())
W=[]
for i in range(N):
    w=input()
    W.append(w)
    last=W[0][-1]
    S=set()
    S.add(w[0])
for i in range(1,N):
    if W[i][0]==last and not W[i] in S:
        pass
    else:
        print("No")
        exit()
    S.add(W[i])
    last=W[i][-1] 
print("Yes")

N=int(input())
W=[]
for i in range(N):
    w=input()
    W.append(w)
    last=W[0][-1]
S=set()
S.add(w[0])
for i in range(1,N):
    if W[i][0]==last and not W[i] in S:
        pass
    else:
        print("No")
        exit()
    S.add(W[i])
    last=W[i][-1] 
print("Yes")

N=int(input())
W=[]
S=set()
for i in range(N):
    w=input()
    W.append(w)
last=W[0][-1]
S.add(w[0])
for i in range(1,N):
    if W[i][0]==last and not W[i] in S:
        pass
    else:
        print("No")
        exit()
    S.add(W[i])
    last=W[i][-1] 
print("Yes")

N=int(input())
W=[]
for i in range(N):
    w=input()
    W.append(w)
last=W[0][-1]
S=set()
S.add(w[0])
for i in range(1,N):
    if W[i][0]==last and not W[i] in S:
        pass
    else:
        print("No")
        exit()
    S.add(W[i])
    last=W[i][-1] 
print("Yes")

N=int(input())
W=[]
for i in range(N):
    w=input()
    W.append(w)
last=W[0][-1]
S=set()
S.add(w[0])
for i in range(1,N):
    if W[i][0]==last and not W[i] in S:
        pass
    else:
        print("No")
        exit()
    S.add(W[i])
    last=W[i][-1]
print("Yes")

N=int(input())
W=[]
for i in range(N):
    w=input()
    W.append(w)
last=W[0][-1]
S=set()
S.add(W[0])
for i in range(1,N):
    if W[i][0]==last and not W[i] in S:
        pass
    else:
        print("No")
        exit()
    S.add(W[i])
    last=W[i][-1]
print("Yes")

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
N = int(input())
W = [input() for i in range(N)]

f = True
for i in range(len(W)-1):
    if W[i][-1] != W[i+1][0]:
        f = False
        break

print(f)

if f and N==len(set(W)):
    print('Yes')
else:
    print('No')


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

f = True
for i in range(len(W)-1):
    if W[i][-1] != W[i+1][0]:
        f = False
        break

if f and N==len(set(W)):
    print('Yes')
else:
    print('No')


Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input()) 
a = [int(input()) for i in range(n)] 

used = [a[0]]
pre = a[0]
for i in a[1:]:
    if i not in used and pre[-1] == i[0]:
        used.append(i)
        pre = i
    else:
        print("No")
        exit()

print("Yes")

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

used = [a[0]]
pre = a[0]
for i in a[1:]:
    if i not in used and pre[-1] == i[0]:
        used.append(i)
        pre = i
    else:
        print("No")
        exit()

print("Yes")

Verdicts: Runtime Error

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

Submission attempts (in order):
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

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

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

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


if __name__=="__main__":
    main()

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

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

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

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


if __name__=="__main__":
    main()

Verdicts: Wrong Answer

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

Submission attempts (in order):
from itertools import tee
N = int(input())
w0, w1 = tee((int(input()) for _ in range(N)), 2)
next(w1)
for a,b in zip(w0,w1):
  if a[-1] != b[0]:
    print('No')
    break
else:
  print('Yes')

from itertools import tee
N = int(input())
w0, w1 = tee((input() for _ in range(N)), 2)

words = {next(w1)}
flag = 'Yes'
for a,b in zip(w0,w1):
  if a[-1] != b[0] or b in words:
    flag = 'No'
  words.add(b)

print(flag)

Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
m = dict()

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

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

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

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

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

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

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

Verdicts: Runtime Error

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

Submission attempts (in order):
L=[]
for i in range(N):
  L.append(input())
if not len(L)==len(set(L)):
  print("NO")
n=0
while n<=N:
  if n==N-1:
    print("Yes")
    break
  elif L[n][-1]==L[n+1][0]:
    n=n+1
  else:
    print("NO")
    break

N=int(input())
L=[]
for i in range(N):
  L.append(input())
if not len(L)==len(set(L)):
  print("NO")
n=0
while n<=N:
  if n==N-1:
    print("Yes")
    break
  elif L[n][-1]==L[n+1][0]:
    n=n+1
  else:
    print("NO")
    break

N=int(input())
L=[]
for i in range(N):
  L.append(input())
if not len(L)==len(set(L)):
  print("NO")
n=0
while n<=N:
  if n==N-1:
    print("Yes")
    break
  elif L[n][-1]==L[n+1][0]:
    n=n+1
  else:
    print("NO")
    break

N=int(input())
L=[]
for i in range(N):
  L.append(input())
if not len(set(L))==len(L):
  print("No")
else:
  for n in range(N):
    if n==(N-1):
      print("Yes")
    elif L[n][-1] == L[n+1][0]:
      continue
    else:
      print("No")
      break

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
N = int(input())
W = [input() for _ in range(N)]

Ws = set([W[0]])
for i in range(1, N):
    if not W[i - 1][-1] == W[i][0] or W[i] in Ws:
        print("No", W[i])
        exit()
    else:
        Ws.add(W[i])

print("Yes")


N = int(input())

W, OK = ["-"], True
for i in range(N):
    W.append(input())
    if W[-1] in W[:-1] or (W[-2][-1] != W[-1][0] and W[-2] != "-"):
        OK = False

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


Verdicts: Wrong Answer

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

Submission attempts (in order):
n=int(input())
s=[]
fla=True
s.append(input())
for i in range(1,n):
    s.append(input())
    if fla :
        if s[i][0]==s[i-1][len(s[i-1])-1]:
            for j in range(i):
                if s[j]==s[i]:
                    fla=False
        else:
            fla=False
if fla:
    print("YES")
else :
    print("NO")

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
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")

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
wls =[]
for i in range(N):
    wls.append(input())
count =0
if len(wls) != len(set(wls)):
    print('No')
else:
    for i in range(N):
        if i == 0:
            continue
        else:
            if wls[i][0] != wls[i-1][-1]:
                count += 1
            
if count == 0:
    print('Yes')
else:
    print('No')
        





#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
wls =[]
for i in range(N):
    wls.append(input())
count =0
if count(wls) != count(set(wls):
    print('No')
else:
    for i in range(N):
        if i == 0:
            continue
        else:
            if wls[i][0] != wls[i-1][-1]:
                count += 1
            
if count == 0:
    print('Yes')
else:
    print('No')
        





#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
wls =[]
for i in range(N):
    wls.append(input())
count =0
if len(wls) != len(set(wls)):
    print('No')
else:
    for i in range(N):
        if i == 0:
            continue
        else:
            if wls[i][0] != wls[i-1][-1]:
                count += 1
            
    if count == 0:
        print('Yes')
    else:
        print('No')
        





Verdicts: Wrong Answer

Runtime Error

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

Submission attempts (in order):
words = []
for inp in range(N):
	words.append(input())

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

N = int(input())
words = []
for inp in range(N):
	words.append(input())

frst = words[0]
wrds = set(words)
if len(wrds) != len(words):
	print("No")
else:	
	for i in range(1,len(words)):
		flag = 1
		if words[i-1][-1] != words[i][0]:
			print("No")
			flag = 0
			break
	if flag == 1:
		print("Yes")  


Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())

string_list=[input() for i in range(N)]
i = 0
string_list2 = list(set(string_list))
if(len(string_list2)==N):
    check = 1
else:
    check = 0

while(i < N-1):
    string1  = string_list[i]
    string2 = string_list[i+1]
    print(string1)
    print(string2)
    str1 = string1[-1]
    str2 = string2[0]
    if(str1 != str2):
        check = 0
    i +=1

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

N = int(input())

string_list=[input() for i in range(N)]
i = 0
string_list2 = list(set(string_list))
if(len(string_list2)==N):
    check = 1
else:
    check = 0

while(i < N-1):
    string1  = string_list[i]
    string2 = string_list[i+1]
    str1 = string1[-1]
    str2 = string2[0]
    if(str1 != str2):
        check = 0
    i +=1

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
def main():
    N = int(input())
    A = [input()]
    for i in range(1, N):
        W = input()
        if A[-1][-1] == W[0]:
            for j in range(i-1):
                if A[j] == W:
                    print("No:重複")
                    return
            A.append(W)
        else:
            print(A, "No:違う")
            return
    print("Yes")

main()

def main():
    N = int(input())
    A = [input()]
    for i in range(1, N):
        W = input()
        if A[-1][-1] == W[0]:
            for j in range(i):
                if A[j] == W:
                    print("No")
                    return
            A.append(W)
        else:
            print("No")
            return
    print("Yes")

main()

Verdicts: Wrong Answer

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

Submission attempts (in order):
N=int(input())
s = [input() for i in range(N)]

atama=[]
oshiri=[]

for i in s:
    atama.append(i[0])
    oshiri.append(i[-1])



oshiri=oshiri[-1:]+oshiri[:-1]

atama.pop(0)
oshiri.pop(0)

if oshiri==atama:
    print("Yes")
else:
    print("No")

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

atama=[]
oshiri=[]

def is_unique(seq):
    return len(seq) == len(set(seq))



for i in s:
    atama.append(i[0])
    oshiri.append(i[-1])



oshiri=oshiri[-1:]+oshiri[:-1]

atama.pop(0)
oshiri.pop(0)

if oshiri==atama and is_unique(s)==True:
    print("Yes")
else:
    print("No")


Verdicts: Wrong Answer

Accepted