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):
loop=int(input())
word=input()
word_list=list()
word_list.append(word)

for i in range(loop-1):
  word=input()
  for j in range(len(word_list)):
    print(word_list[j],word)
    if word_list[j]==word:
      print("No")
      break
  if word_list[i][-1]!=word[0]:
    print("No")
    break
  if j!=len(word_list)-1:
    break
  word_list.append(word)
  if i==loop-2:
    print("Yes")


loop=int(input())
word=input()
word_list=list()
word_list.append(word)
 
for i in range(loop-1):
  word=input()
  for j in range(len(word_list)):
    if word_list[j]==word:
      print("No")
      break
  if word_list[i][-1]!=word[0]:
    print("No")
    break
  if j!=len(word_list)-1:
    break
  word_list.append(word)
  if i==loop-2:
    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())
w = []
a = []
status = True

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

a.append(w[0])

for i in range(1,n):
    a.append(w[i])
    if a.count(w[i]) == 1 and (a[i-1])[-1] == (a[i])[0]:
        pass
    else:
        status == False
        print(status)
        break

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



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

w_s = w.copy()
w_s = set(w_s)
w_s = list(w_s)

if len(w) != len(w_s):
    print("No")
    exit()

for i in range(n-1):
    a = w[i]
    b = w[i+1]
    if a[-1] != b[0]:
        print("No")
        exit()
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):
Row = int(input())
flag = True
List = []
for i in range (Row):
  List.append(int(input()))
s_l = set(List)
if len(List) != len(s_l):
  print("No")
for i in range(Row-1):
  n = len(List[i])-1
  if List[i][n] != List[i+1][0]:
    flag = False
if flag:
  print("Yes")
else:
  print("No")

Row = int(input())
flag = True
List = []
for i in range (Row):
  List.append(input())
s_l = set(List)
if len(List) != len(s_l):
  print("No")
else:
  for i in range(Row-1):
    n = len(List[i])-1
    if List[i][n] != List[i+1][0]:
      flag = False
  if flag:
    print("Yes")
  else:
    print("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):
N = int(input())
A = list()
cnt = 0
A.append(input())
for i in range(N-1):
  x = input()
  if x in A:
    cnt = 1
  elif A[i][-1:] != x[0]:
    cnt = 1
  else:
    A.append(x)
print('Yes' if cnt == 0 else 'No')

N = int(input())
A = list()
cnt = 0
A.append(input())
for i in range(N-1):
  x = input()
  if x in A:
    cnt = 1
  elif A[i][-1:] != x[0]:
    cnt = 1
  A.append(x)
print('Yes' if cnt == 0 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):
input_lines = int(input())
lastchar = ''
for i in range(input_lines):
    s = input().rstrip()
    if len(lastchar) > 0 and not s[0] in lastchar:
        print('No')
        break
    lastchar = s[-1]
else:
    print('Yes')
    

input_lines = int(input())
tango=[]
lastchar = ''
for i in range(input_lines):
    s = input().rstrip()
    if len(lastchar) > 0 and not s[0] in lastchar or s in tango:
        print('No')
        break
    tango.append(s)
    lastchar = s[-1]
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())

list=[]
for i in range(n):
  list.append(input())
  
import collections
c=collections.Counter(list)
t=0
for i in range(n-1):

  if list[i][len(list[i])-1]==list[i+1][0]:
    
    t += 1
  else:
    pass

print(t)

if t == n-1 and len(c) == n:
  print("Yes")
else:
  print("No")

n= int(input())

list=[]
for i in range(n):
  list.append(input())
  
import collections
c=collections.Counter(list)
t=0
for i in range(n-1):

  if list[i][len(list[i])-1]==list[i+1][0]:
    
    t += 1
  else:
    pass

if t == n-1 and len(c) == n:
  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())
vo=[]
flag=1
for i in range(N):
    vo.append(input())
    
if len(vo) != len(set(vo)):
    flag=0
    
for i in range(N-1):
    a=vo[i]
    b=vo[i+1]
    #print(a[len(a)-1],b[0])   
    if a[len(a)-1] != b[0]:
        flag=0    
if flag == 0:
    print("NO")
else:
    print("YES")

N=int(input())
vo=[]
flag=1
for i in range(N):
    vo.append(input())
    
if len(vo) != len(set(vo)):
    flag=0
    
for i in range(N-1):
    a=vo[i]
    b=vo[i+1]
    if a[len(a)-1] != b[0]:
        flag=0
        
if flag == 0:
    print("NO")
else:
    print("YES")

N=int(input())
vo=[]
flag=True
for i in range(N):
    vo.append(input())
    
if len(vo) != len(set(vo)):
    flag=False
    
for i in range(N-1):
    a=vo[i]
    b=vo[i+1]  
    if a[len(a)-1] != b[0]:
        flag=False
        
if not flag:
    print("No")
else:
    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())
W = []
W.append(input())
for _ in range(N-1):
    W.append(input())
    if W[-1] in W[:-2]
        print("No")
        break
    if W[-1][0] != W[-2][-1]:
        print("No")
        break
else:
    print("Yes")

N = int(input())
W = []
W.append(input())
for _ in range(N-1):
    W.append(input())
    if (W[-1] in W[:-2]) or (W[-1][0] != W[-2][-1]):
        print("No")
        break
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())
words = []
for i in range(n):
  words.append(input())

ans = "Yes"
  

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

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

flag = True

for i in range(n-1):
    s = input()
    if s not in l and s[0] == l[-1][-1]:
        l.append(s)
    else:
        flag = False
        break

if flag:
    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())
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")


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

correct = True
for i in range(1, 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")


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


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())
s=[input() for i in range(n)];print(s)
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")

n=int(input())
s=[input() for i in range(n)]
if len(s) != len(set(s)):
  print("No");exit()
for c,d in zip(s[0:],s[1:]):
  if c[-1] != d[0]:
    print("No");exit()
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())
a=[input() for i in range(n)]
s=0
for i in raneg(n-1):
    if a[i][-1]!=a[i+1][0]:
        s+=1
a.sort()
for i in raneg(n-1):
    if a[i]==a[i+1]:
        s+=1
if s==0:
    print("Yes")
else:
    print("No")

n=int(input())
a=[input() for i in range(n)]
s=0
for i in range(n-1):
    if a[i][-1]!=a[i+1][0]:
        s+=1
a.sort()
for i in range(n-1):
    if a[i]==a[i+1]:
        s+=1
if s==0:
    print("Yes")
else:
    print("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):
N = int(input())
w = input()
W_list = [w]
for i in range(N-1):
  W = input()
  if w[-1] == W[0] and W not in W.list:
    W_list.append(w)
    w = W
  else:
    print("No")
    exit()
print("Yes")

N = int(input())
w = input()
W_list = [w]
for i in range(N-1):
  W = input()
  if w[-1] == W[0] and W not in W_list:
    W_list.append(w)
    w = W
  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):
n = int(input())
l = []
for i in range(n):
    w = input()
    l.append(w)
for k in range(n):
    if  l[k-1][-1] == l[k][0]:
        for j in range(i):
            if l[k] == l[j]:
                flag = 0
                break
            else:
                flag = 1
    else:
        flag = 0
if(flag == 1):
    print('Yes')
else:
    print('No')

n = int(input())
for i in range(n):
    w = input()
    if i > 0:
        if  w[i-1][-1] == w[i][0]:
            for j in range(i):
                if w[i] == w[j]:
                    print('No')
                else:
                    print('Yes')
        else:
            print('No')

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

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

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):
n = int(input())
a = [input() for i in range(n)]
for i in range(n-1):
  if a[i][-1] == a[i+1][0]:
    continue
  else:
    print('No')
    exit()
print('Yes')
    

n = int(input())
a = [input() for i in range(n)]
for i in range(n):
    num  = a.count(a[i])
    if num > 1:
        print('No')
        exit()
for i in range(n-1):
    if a[i][-1] == a[i+1][0]:
        continue
    else:
        print('No')
        exit()
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())
W = [input() for i in range(N)]
L = []
ans = "Yes"
for i in range(1,N):
  if W[i] in L:
    ans = "No"
  if W[i][0] != W[i-1][-1]:
    ans = "No"
  L.append(W[i])
print(ans)


N = int(input())
W = [input() for i in range(N)]
S = set([W[0]])
ans = "Yes"
for i in range(1,N):
  if W[i] in S:
    ans = "No"
  if W[i][0] != W[i-1][-1]:
    ans = "No"
  S.add(W[i])
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):
n = int(input())

words = {}
w = ''
ok = True
for i in range(n):
  nw = input()
  if nw in words:
    ok = False
    break
  words.add(w)
  if w && w[-1] != nw[0]:
    ok = False
  w = nw

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


n = int(input())

words = {}
w = ''
ok = True
for i in range(n):
  nw = input()
  if nw in words:
    ok = False
    break
  words.add(w)
  if w && w[-1] != nw[0]:
    ok = False
  w = nw

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

n = int(input())

words = {}
w = ''
ok = True
for i in range(n):
  nw = input()
  if nw in words:
    ok = False
    break
  words.add(w)
  if w and w[-1] != nw[0]:
    ok = False
  w = nw

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


n = int(input())

words = set()
w = ''
ok = True
for i in range(n):
  nw = input()
  if nw in words:
    ok = False
    break
  words.add(w)
  if w and w[-1] != nw[0]:
    ok = False
  w = nw

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

Verdicts: Runtime Error

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())
a = [input() for i in range(n)]
b = []
b.append(a[0])
res = True
for i in range(1,n):
    if a[i-1][-1] != a[i][0]:
        res = False
        break
    if a[i] in b:
        res = False
        break
    b.append(a[i])

if res:
    print('Yes')
else:
    print('NO')

n = int(input())
a = [input() for i in range(n)]
b = []
b.append(a[0])
res = True
for i in range(1,n):
    if a[i-1][-1] != a[i][0]:
        res = False
        break
    if a[i] in b:
        res = False
        break
    b.append(a[i])

if res:
    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())
w=[input() for i in range(N)]
rule = 'No'
for x in range(1, N):
    if w[x-1][len(w[x-1])-1] == w[x][0]:
        rule = 'Yes'
    for y in range(x):
        if w[y]==w[x]:
            rule='No'
            break
print(rule)

N=int(input())
w=[input() for i in range(N)]
rule = 'Yes'
same = False
for x in range(1, N):
    rule='Yes'
    same = False
    if w[x-1][len(w[x-1])-1] != w[x][0]:
       rule = 'No'
       break
    for y in range(x):
        if w[y]==w[x]:
            rule='No'
            same = True
            break
    if same:
        break
print(rule)

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())
w=[input() for i range(n)]
d={}
for i in range(n):
  if w[i] not in d:
    d[w[i]]=1
  else:
    print('No')
    exit()
for i in range(n-1):
  if w[i][len(w[i])-1]!=w[i+1][0]:
    print('No')
    exit()
print('Yes')

n=int(input())
w=[input() for i in range(n)]
d={}
for i in range(n):
  if w[i] not in d:
    d[w[i]]=1
  else:
    print('No')
    exit()
for i in range(n-1):
  if w[i][len(w[i])-1]!=w[i+1][0]:
    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):
n = int(input())
aa = []
for i in range(n):
    a = input()
    aa.append(a)
print(aa)

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

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

bb = []
if len(set(aa)) != len(aa):
    print('No')
else:
    for i in range(n-1):
        if aa[i][-1] == aa[i+1][0]:
            bb.append(True)
        else:
            bb.append(False)
    if all(bb):
        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())
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')

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

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

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

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

if flg:
    print('Yes')


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

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


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

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


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())
w=[int(x) for x in input().split()]
ans='Yes'
for i in range(1,n):
  if w[i-1][-1]!=w[i][0]:
    ans='No'
    break
  for j in range(i):
    if w[i]==w[j]:
      ans='No'
      break
print(ans)


n=int(input())
w=[input() for _ in range(n)]
ans='Yes'
for i in range(1,n):
  if w[i-1][-1]!=w[i][0]:
    ans='No'
    break
  for j in range(i):
    if w[i]==w[j]:
      ans='No'
      break
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())
s = [str(input())]
for i in range(1, N):
    x = str(input())
    if x[0] != s[i-1][-1]:
        print('No')
    break
    s.append(x)
if len(set(s)) == len(s):
    print('Yes')
else:
    print('No')

n = int(input())
s = set()
for i in range(n):
    w = str(input())
    if i == 0:
        p = w
        s.add(w)
    else:
        if w[0] != p[-1] or w in s:
            print('No')
            exit()
        else:
            p = w
            s.add(w)
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):
# ABC 109, B - shiritori

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


used = []

for i in range(n):
    print(i)
    if i == 0:
        used.append(w[i])
        tail = w[i][-1]
    else:
        # no if the same word is used
        if w[i] in used:
            print('No')
            break
        # no if the hean and tail is not equal
        elif w[i][0] != tail:
                print('No')
                break
        else:
            used.append(w[i])
            tail = w[i][-1]
else:
    print('Yes')


# ABC 109, B - shiritori

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


used = []

for i in range(n):
    if i == 0:
        used.append(w[i])
        tail = w[i][-1]
    else:
        # no if the same word is used
        if w[i] in used:
            print('No')
            break
        # no if the hean and tail is not equal
        elif w[i][0] != tail:
                print('No')
                break
        else:
            used.append(w[i])
            tail = w[i][-1]
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):
import sys
# N,M = [int(n) for n in input().split()]
# S = str(input())
# T = str(input())

N = int(input())
SS = [0]*N
s = set()
SS[0] = str(input())
for i in range(1,N):
    SS[i] = str(input())
    if(SS[i] in s):
        print('No')
        sys.exit()
    s.add(SS[i])
for i in range(1,N):
    if(SS[i-1][-1] != SS[i][0]):
        print('No')
        sys.exit()
print('Yes')


import sys
# N,M = [int(n) for n in input().split()]
# S = str(input())
# T = str(input())

N = int(input())
SS = [0]*N
s = set()
SS[0] = str(input())
s.add(SS[0])
for i in range(1,N):
    SS[i] = str(input())
    if(SS[i] in s):
        print('No')
        sys.exit()
    s.add(SS[i])
for i in range(1,N):
    if(SS[i-1][-1] != SS[i][0]):
        print('No')
        sys.exit()
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):
import sys
def is_unique(seq):
    return len(seq) == len(set(seq))

N = int(input())
W = []
for i in range(N):
    w.append((input()))
if is_unique(W):
    for i in range(N-1):
        if W[i][-1] != W[i+1][0]:
            print("No")
            sys.exit()
    print("Yes")

else:
    print("No")


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

N = int(input())
W = []
for i in range(N):
    W.append((input()))
if is_unique(W):
    for i in range(N-1):
        if W[i][-1] != W[i+1][0]:
            print("No")
            sys.exit()
    print("Yes")

else:
    print("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):
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")


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
    print(buf[-1:])

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


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


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):
4
hoge
english
hoge
enigma


N = int(input())
W = input()
L = []
L.append(W)
last = W[-1]
ans = 'Yes'
for _ in range(N-1):
    w = input()
    if w in L:
        ans = 'No'
    if last == w[0]:
        last = w[-1]
        L.append(w)
    else:
        ans = 'No'
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())

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

ans=True
if all(a.count(w) == 1 for w in a):
    for i in range(n-1):
        if a[i][-1]!=a[i+1][0]:
            ans=False
    
if ans:    
    print('Yes')
else:
    print('No')

n=int(input())

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

ans=True
if all(a.count(w) <2  for w in a):
    for i in range(n-1):
        if a[i][-1]!=a[i+1][0]:
            ans=False
else:
    ans=False
    
if ans:    
    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):
a = input()

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

    return 'Yes'
                

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



a = input()
b = input()

words = b.split()

for i in range(len(words)-1):
    w1 = words[i]
    w2 = words[i+1]

    if w1[-1] != w2[0]:
        return 'No'

return 'Yes'



a = input()
b = input()

words = b.split('\n')
print(words)
def main():
    ed = []
    for i in range(int(a)-2):
        w1 = words[i]
        ed.append(w1)
        w2 = words[i+1]
        print(ed)
        if w1[-1] != w2[0] or w1 in ed:
            return 'No'
    return 'Yes'

if __name__ == '__main__':
    main()



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



Verdicts: Wrong Answer

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())
dic = dict()
for i in range(N):
    S = input()
    if S in dic:
        dic[S] += 1
    else:
        dic[S] = 1
    Start  = S[0]
    if i != 0:
        if Start != End or dic[S] > 1:
            print("No")
            exit
    End = S[len(S)-1]
print("Yes")

N = int(input())
dic = dict()
for i in range(N):
    S = input()
    if S in dic:
        dic[S] += 1
    else:
        dic[S] = 1
    Start  = S[0]
    if i != 0:
        if Start != End or dic[S] > 1:
            print("No")
            exit()
    End = S[len(S)-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 = int(input())
rec = []
flag = True
t = input()
pre = t[-1]
for i in range(1, n):
    s = input()
    if s in rec:
        flag = False
    elif s[0] != pre:
        flag = False
    else:
        rec.append(s)
        pre = s[-1]

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


N = int(input())
s = set()
pre = ""
flag = True
for i in range(N):
    w = input()
    if len(s) == 0:
        pre = w[-1]
        s.add(w)
        continue
    else:
        if w[0] != pre:
            flag = False
        elif w in s:
            flag = False
        else:
            pre = w[-1]
            s.add(w)

if flag:
    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):
3
abc
arc
agc

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

Verdicts: Runtime Error

Accepted