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 = int(input())

cache = []
abc = ''
ngflag = False
for i in range(N):
    word = input()
    if abc != '':
        if word[0] != abc:
            print(word)
            ngflag = True
    if word in cache:
        print(word)
        ngflag = True
    abc = word[-1]
    cache.append(word)

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

N = int(input())

cache = []
abc = ''
ngflag = False
for i in range(N):
    word = input()
    if abc != '':
        if word[0] != abc:
            print(word)
            ngflag = True
    if word in cache:
        print(word)
        ngflag = True
    abc = word[-1]
    cache.append(word)

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

N = int(input())

cache = []
abc = ''
ngflag = False
for i in range(N):
    word = input()
    if abc == '':
        pass
    elif word[0] != abc:
        ngflag = True

    if word in cache:
        ngflag = True
    abc = word[-1]
    cache.append(word)

if ngflag:
    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())
a=[]
a.append(input())
l=1
for i in range(n-1):
    s=input()
    if s not in a and a[i][-1]==s[0]:
        a.append(s)
    else:
        l=0
        break
if l==1:
    print("YES")
else:
    print('NO')

n = int(input())
list_words = []
for q in range(n):
    list_words.append(input())


def check(l):
    for i in range(len(l)-1):
        if l[i][-1] != l[i+1][0]:
            return "NO"
    for o in range(len(l)):
        if l[o] in l[:o] or o in l[o+1:]:
            return "NO"
    return "YES"


print(check(list_words))


import sys
n=int(input())
w=[]
check=False
for i in range (n):
    w.append(input())
for i in range (1,n-1,1):
    for j in range (0,i):
      if w[i]!=w[j]:
        if w[i][0]==w[i-1][len(w[i-1])-1]:
          check=True
      else:
         check=False
         break
if check:
    print('YES')
else:
    print('NO')


n=int(input())
words=[]
gm='NO'
rep='YES'
for i in range(n):
    c=input()
    for j in range(i):
        if c==words[j]:
            rep='NO'
            break
    words.append(c)

for i in range(n-1):
    a=words[i]
    b=words[i+1]
    if b[0]==a[len(a)-1]:
        gm='YES'
        continue
    else:
        break
if rep=='NO':
    print(rep)
else:
    print(gm)

n=int(input())
w=[]
check=False
for i in range (n):
    w.append(input())
for i in range (1,n-1,1):
    for j in range (0,i):
      if w[i]!=w[j]:
        if w[i][0]==w[i-1][len(w[i-1])-1]:
          check=True
      else:
         check=False
         break
if check:
    print('YES')
else:
    print('NO')


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

def taka():
    n = int(input())
    listofwords =[]
    for i in range(n):
        strTEMP = input()

        if i == 0:
            listofwords.append(strTEMP)
            continue
        else:
            if strTEMP in listofwords:
                return "No"
            else:
                cmp = listofwords[-1]
                if strTEMP[0] != cmp[-1]:
                    return "No"
                else:
                    listofwords.append(strTEMP)
    return "Yes"

print(taka())


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

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())
ans = "Yes"
arr = []
for i in range(N)
    arr.append(input())
    if not i == 1:
        if arr[i] in arr and arr[i-1][-1] == arr[i][0]
            pass
        else:
            ans = "No"
            break

print(ans)


N = int(input())
ans = "Yes"
arr = []
for i in range(N):
    arr.append(input())
    if not i == 0:
        if arr[i-1][-1] == arr[i][0] and not arr[i] in arr[:-2]:
            pass
        else:
            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())
list_w = [input() for s in range(0, n)]
for i in range(0, n):
    if i == 0 or (list_w[i - 1][-1] == list_w[i][0]) and list_w[i] not in list_w[:i]:
        print(list_w[i])
        continue
    else:
        print("No")
        exit()
print("Yes")

n = int(input())
list_w = [input() for s in range(0, n)]
for i in range(0, n):
    if i == 0 or (list_w[i - 1][-1] == list_w[i][0]) and list_w[i] not in list_w[:i]:
        continue
    else:
        print("No")
        exit()
print("Yes")

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=open(0).readlines()
if len(set(a))<len(a):
  print("No")
  exit()
b=[(i[0],i[-2]) for i in a]
for k in range(len(b)-1):
  if b[k][1]!=b[k+1][0]:
    print("No")
    exit()
print("Yes")

n,*a=open(0).read().split()
if len(a)>len(set(a)):
    print("No")
    exit()
else:
    s=a[0][-1]
    for i in range(1,int(n)):
        if s==a[i][0]:
            s=a[i][-1]
        else:
            print("No")
            exit()
        #print(a[i][0])
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())
w=[input() for i in range(w)]
ans="Yes"
for j in range(1,len(w)):
  if w[j-1][len(w[j-1])-1]!=w[j][0]:
    ans="No"
print(ans)

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

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


Verdicts: 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):
n=int(input())
for i in range(n):
    a.append(input())
if len(a)!=len(set(a)):
    print('No')
    exit()
for i in range(n-1):
    if a[i][-1]!=a[i+1][0]:
        print('No')
        exit()
print('Yes')

n=int(input())
a=[]
for i in range(n):
    a.append(input())
if len(a)!=len(set(a)):
    print('No')
    exit()
for i in range(n-1):
    if a[i][-1]!=a[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())
W = [list(input()) for _ in range(N)]
ans = 'Yes'
W_set = set(W)
if len(W) == len(W_set):
  for i in range(1, N - 1):
    if W[i][0] != W[i-1][-1]:
      ans = 'No'
      break
else:
  ans = 'No'
print(ans)

N = int(input())
W = [input() for _ in range(N)]
ans = 'Yes'
W_set = set(W)
if len(W) == len(W_set):
  for i in range(1, N):
    if W[i][0] != W[i-1][-1]:
      ans = 'No'
      break
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):
import sys
N,*W = map(str,open(0).read().split())
N = int(N)
for i in range(N-1):
    if list(W[i])[-1] != list(W[i+1])[0]:
        print("No")
        sys.exit()
print("Yes")

import sys
N,*W = map(str,open().read().split())
N = int(N)
for i in range(N-1):
    if list(N[i])[-1] != list(N[i+1])[0]:
        print("No")
        sys.exit()
print("Yes")

import sys
N,*W = map(str,open().read().split())
N = int(N)
for i in range(N-1):
    if list(W[i])[-1] != list(W[i+1])[0]:
        print("No")
        sys.exit()
print("Yes")

import sys
N,*W = map(str,open(0).read().split())
N = int(N)
for i in range(N-1):
    if list(W[i])[-1] != list(W[i+1])[0]:
        print("No")
        sys.exit()
if len(W) != len(set(W)):
    print("No")
    sys.exit()
print("Yes")

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):
from collections import defaultdict
dic = defaultdict(str)
n = int(input())
lst = [input() for _ in range(n)]
last = lst[0]
flag = True
for i in range(1, n):
  if lst[i][0] != last[-1]:
  	flag = False
    break
  dic[lst[i]] += 1
  if dic[lst[i]] > 1
  	flag = False
    break
if flag:
  print("Yes")
else:
  print("No")
  

from collections import defaultdict
dic = defaultdict(int)
n = int(input())
lst = [input() for _ in range(n)]
last = lst[0]
flag = True
for i in range(1, n):
  if lst[i][0] != last[-1]:
    flag = False
    break
  dic[lst[i]] += 1
  if dic[lst[i]] > 1:
    flag = False
    break
  last = lst[i]
if flag:
  print("Yes")
else:
  print("No")

from collections import defaultdict
dic = defaultdict(int)
n = int(input())
lst = [input() for _ in range(n)]
last = lst[0]
dic[last] = 1
flag = True
for i in range(1, n):
  if lst[i][0] != last[-1]:
    flag = False
    break
  dic[lst[i]] += 1
  if dic[lst[i]] > 1:
    flag = False
    break
  last = lst[i]
if flag:
  print("Yes")
else:
  print("No")

Verdicts: 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):
n = int(input())
s = set()

ok = True
t = input()
p = t[-1]
for i in range(n-1):
  t = input()
  if t in s:
    ok = False
  s.add(t)
  if t[0] != p:
    ok = False
  p = t[-1]
  
print('Yes' if ok else 'No')

n = int(input())
s = set()

ok = True
t = input()
p = t[-1]
s.add(t)
for i in range(n-1):
    t = input()
    if t in s:
        ok = False
    s.add(t)
    if t[0] != p:
        ok = False
    p = t[-1]

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())
w = [input(x) for x in range(n)]
s = set(w)
ans ='Yes'
if len(s) !=n:
  ans ='No'
else:
  for i in range(n):
    if w[i][0] != w[i-1][-1]:
      ans ='No'
    else:
      ans ='Yes'
print(ans)


n = int(input())
s =[input() for _ in range(n)]
ans =0
if len(s) != len(set(s)):
  ans = 1
for i in range(1,n):
  if s[i-1][-1] != s[i][0]:
    ans =1
print('No' if ans ==1 else '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):
from sys import exit
n=int(input())
s=input()
w=[]
w.append(s)
for i in range(n-1):
  s=input()
  if w[i][-1]!=a[0] or s in w:
    print('No')
    exit()
  else:
    w.append(s)
print('Yes')
  

from sys import exit
n=int(input())
s=input()
w=[]
w.append(s)
for i in range(n-1):
  s=input()
  if w[i][-1]!=s[0] or s in w:
    print('No')
    exit()
  else:
    w.append(s)
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):
c = int(input())
w = []
for i in range(c):
  w.append(input())
if len(set(w)) != len(w):
  print("No")
  return
for i in range(len(w) - 1):
  if w[i][-1] != w[i+1][0]:
    print("No")
    return
print("Yes")

falsify = "Yes"
c = int(input())
w = []
for i in range(c):
  w.append(input())
if len(set(w)) != len(w):
  falsify = "No"
for i in range(len(w) - 1):
  if w[i][-1] != w[i+1][0]:
    falsify = "No"
print(falsify)

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=[]
for i in range(n):
  aa=input()
  if aa in a or aa[0] != a[-1][0]:
    print("No")
    break
  if i == n-1:
    print("Yes")
  a.append(aa)

n=int(input())
a=[input()]
for i in range(n-1):
  aa=input()
  if aa in a or aa[0] != a[-1][-1]:
    print("No")
    break
  if i == n-2:
    print("Yes")
  a.append(aa)


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())
word_list = []
ans = "Yes"
preword = input()

for i in range(n-1):
    w = input()
    if w in word_list:
        ans = "No"
    if preword[-1] != w[0]:
        ans = "No"
    word_list.append(w)
    preword = w
print(ans)

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

n=int(input())
s=input()
ans=0
for i in range(n-1):
  keep=s[-1]
  s=input()
  if keep != s[0]:
    ans=1
  else:
    continue
print(["Yes","No"][ans])
    
  


n=int(input())
check=[]
s=input()
check.append(s)
ans=0
for i in range(n-1):
  keep=s[-1]
  s=input()
  if keep != s[0]:
    ans=1
  if str(s) in check:
    ans = 1
  else:
    check.append(s)
print(["Yes","No"][ans])

Verdicts: 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):
N = int(input())
used = [input()]
flag = 1
for i in range(N-1):
  now = input()
  if now not in used and used[-1][-1] == now[0]:
    used.append(now)
  else:
    flag = 0
   	break
if flag == 1:
  print("Yes")
else:
  print("No")

N = int(input())
used = [input()]
flag = 1
for i in range(N-1):
  now = input()
  if now not in used and used[-1][-1] == now[0]:
    used.append(now)
  else:
      flag = 0

if flag == 1:
  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=[str(input())]
ans="Yes"
for i in range(n-1):
    x=str(input())
    w.append(x)
    y=w[i]
    if x[0]!=y[-1]:
        ans="No"
        break
print(ans)

n=int(input())
w=[str(input())]
ans="Yes"
for i in range(n-1):
    x=str(input())
    if x in w:
        ans="No"
        break
    w.append(x)
    y=w[i]
    if x[0]!=y[-1]:
        ans="No"
        break
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())
w = [input() for i in range(n)]
flag = 1



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

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



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


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=[]
w=''
for i in range(n):
    if i !=0 and w[-1] !=str(input())[0]:
        print('No')
        exit()
    else:
        w=str(input())
        W.append(w)
if len(W) != len(list(set(W))):
    print('No')
    exit()
print('Yes')

n =int(input())
W=[]
w=''
for i in range(n):
    s=str(input())
    if i !=0 and w[-1] != s[0]:
        print('No')
        exit()
    else:
        w=s
        W.append(w)
if len(W) != len(list(set(W))):
    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())
W = []
w_dic = dict()
for i in range(N):
    W.append(input())

check = True
for i in range(N-1):
    if W[i][-1] == W[i+1][0]:
        continue
    else:
        check = False
        break
for i in range(N):
    if W[i] in w_dic:
        check = False
    else:
        w_dict[W[i]] = 1
if check:
    print('Yes')
else:
    print('No')

N = int(input())
W = []
w_dic = dict()
for i in range(N):
    a = input()
    W.append(a)

check = True
for i in range(N-1):
    s = W[i]
    s_1 = W[i+1]
    if s[-1] == s_1[0]:
        continue
    else:
        check = False
        break
for i in range(N):
    if W[i] in w_dic:
        check = False
        break
    else:
        w_dic[W[i]] = 1
if check:
    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())
flag_1 = 1
flag_2 = None
inf = [input() for i in range(N)]
print(inf)
for j in range(N):
  for k in range(N):
    if inf[j]==inf[k]:
      flag_1 = 0
      break

for p in range(N-1):
  sear_1 = [q for q in inf[p]]
  sear_2 = [o for o in inf[p+1]]
  if sear_1[-1]==sear_2[0]:
    flag_2 = 1
  else:
    flag_2 = 0
if flag_1 == 1 and flag_2 == 1:
  print("Yes")
elif flag_2 == 0 and flag_2 == 0:
  print("No")
    

N=int(input())
x=[input() for _ in range(N)]
flag=0

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

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

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 = []
for i in range(N):
  word = list(input())
  if i == 0:
    words.append(word[len(word)])
  elif i == N-1:
    words.append(word[0])
  else:
    words.append(word[0])
    words.append(word[len(word)])
  
if len(set(words))*2 - len(words) == 0:
  print("Yes")
else:
  print("No")
  
  

N = int(input())
words = []
l = []
for i in range(N):
    a = input()
    if i == 0:
        l.append(a)
        b = list(a)
        words.append(b[len(b)-1])
    elif a not in l and i > 0:
        b = list(a)
        print(b)
        if i == N-1:
            words.append(b[0])
        else:
            words.append(b[0])
            words.append(b[len(b)-1])
        l.append(a)
    elif a in l and i > 0:
        print("No")
        exit(1)

for h in range(0,len(l)-2,2):
    if l[h] == l[h+1]:
        flag = True
if all(l):
#if len(set(words))*2 - len(words) == 0:
    print("Yes")
else:
    print("No")

N = int(input())
words = []
l = []
for i in range(N):
    a = input()
    if i == 0:
        l.append(a)
        b = list(a)
        words.append(b[len(b)-1])
    elif i > 0:
        b = list(a)
        if i == N-1:
            words.append(b[0])
        else:
            words.append(b[0])
            words.append(b[len(b)-1])
        l.append(a)

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

for h in range(0,len(words),2):
    if words[h] != words[h+1]:
        print("No")
        exit()
print("Yes")

    

    


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

used = []
ans = "Yes"

for i in range(n):
    if i == 0:
        t = str(input())
    else:
        t = str(input())
        print(t + "!")
        for j in used:
            if t == j:
                ans = "No"

        if len(t) == 1:
            if past[]
            
        else:
            if past[-1] != t[0]:
               ans == "No"
    used.append(t)
    past = t

print(ans)


s = int(input())
last = str(input())
wordlist = [last]
ans = "Yes"

for i in range(s-1):
    word = str(input())

    if last[-1] != word[0]:
        ans = "No"
        break
    
    elif word in wordlist:
        ans = "No"
        break

    last = word
    wordlist.append(word)

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())
L = []

Ans = True

for i in range(N):
    a =input()
    L.append(a)

for j in range(N-1):
    if list(L[j])[-1] != list(L[j+1])[0]:
        Ans = False

for k in range(N):
    if L[i] in L[:i]:
        Ans = False
        
if Ans == True:
    print('Yes')
else:
    print('No')

N = int(input())
L = []

Ans = True

for i in range(N):
    a =input()
    L.append(a)

for j in range(N-1):
    if list(L[j])[-1] != list(L[j+1])[0]:
        Ans = False

for k in range(N):
    if L[k] in L[:k]:
        Ans = False
        
if Ans == True:
    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())
siritori_list = list()
for i in range(n):
    siritori_list.append(input())
for ii in range(n):
    word = siritori_list.pop(0)
    print(word,siritori_list)
    if siritori_list:
        if not(word[-1] == siritori_list[0][0]) or word in siritori_list:
            print("No")
            break
else:
    print("Yes")

n = int(input())
siritori_list = list()
for i in range(n):
    siritori_list.append(input())
for ii in range(n):
    word = siritori_list.pop(0)
    if siritori_list:
        if not(word[-1] == siritori_list[0][0]) or word in siritori_list:
            print("No")
            break
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
import numpy as np
import collections as cl
import itertools as it
# import more_itertools as mit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(100000)

n = int(readline())
w = list(readlines().split())
dic = set()

for i in w:
    if i == 0:
        dic.append(i)
        continue
    if i in dic or dic[i-1][-1] != dic[i][0]:
        print('No')
        sys.exit()
    dic.append(i)
print('Yes')

import sys
import numpy as np
import collections as cl
import itertools as it
# import more_itertools as mit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(100000)

n = int(readline())
w = [input().strip() for _ in range(n)]
dic = set()

for num, i in enumerate(w):
    if num == 0:
        dic.add(i)
        continue
    if i in dic or w[num-1][-1] != i[0]:
        print('No')
        sys.exit()
    dic.add(i)
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())
a = [input() for i in range(n)] 

for i in range(1, n):
  if a[i-1][-1]!=a[i][0] or a[i]==a[:i-1]:
    print('No')
    break
  else:
    print('Yes')

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

for i in range(1, n):
  if a[i-1][-1]!=a[i][0] or a[i] in a[:i-1]:
    print('No')
    break
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())
c=0
m=[]
s=input()
m.append(s)
for i in range(N-1):
  l=input()
  if l not in m and m[i][-1]==l[0]:
    c+=1
  m.append(l)
if c==N-1:
  print("YES")
else:
  print("NO")

N=int(input())
c=0
m=[]
s=input()
m.append(s)
for i in range(N-1):
  l=input()
  if l not in m and m[i][-1]==l[0]:
    c+=1
  m.append(l)
if c==N-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):
n=input()
x=[]
for i in range(n):
  w = input()
  if i !=0 and (w in x or x[i-1][-1] != w[0]):
    print ("No")
    exit()
  x.append(w)
print("Yes")
    

n = int(input())
s  = input()
L = [s]
for i in range(n-1):
  t = input()
  if t[0] != s[len(s)-1] or t in L:
    print("No")
    exit()
  L.append(t)
  s = t
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=input()
N=int(input())
S=[input() for i in range(N)]
ans='Yes'
if len(set(S))!=N:
    ans='No'
for i in range(N-1):
    if S[i][len(S[i])-1]!=S[i+1][0]:
        ans='No'
print(ans)


N=int(input())
S=[input() for i in range(N)]
ans='Yes'
if len(set(S))!=N:
    ans='No'
for i in range(N-1):
    if S[i][len(S[i])-1]!=S[i+1][0]:
        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())
s=[input()]
count=1
for i in range(n-1):
    w=input()
    s.append(w)
    if s[i][-1]==s[i+1][0]:
        count=count+1
if count==n and len(s)==len(set(s)):
    print("Yes")
else:
    print("no")

n=int(input())
s=[input()]
count=1
for i in range(n-1):
    w=input()
    s.append(w)
    if s[i][-1]==s[i+1][0]:
        count=count+1
if count==n and len(s)==len(set(s)):
    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):
x1, y1, x2, y2 = map(int, input().split())
print(x2+(y1-y2),y2+(x2-x1),x1+(y1-y2),y1+(x2-x1))

n = int(input())
list_w = [input() for i in range(n)]
list_ok = [list_w[0]]

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

else:
    for i in range(1, n):
        if list_w[i - 1][-1] == list_w[i][0]:
            list_ok.append(list_w[i])
            i += 1
    if len(list_ok) == len(list_w):
        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 = [input() for i in range(n)]

def shiritori(s):
  if len(s) != len(set(s)):
    return "No"
  
  for i in range(n-1):
    if s[i][-1] != s[i+1][0]:
      return "No"
  
  return "Yes"

shiritori()

n = int(input())

s_list = []
for i in range(n):
  s = input()
  s_list.append(s)

def shiritori():
  if len(s_list) != len(set(s_list)):
    return "No"
  
  for i in range(n-1):
    if s_list[i][-1] != s_list[i+1][0]:
      return "No"
  
  return "Yes"

n = int(input())

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

def shiritori(s):
  if len(s) != len(set(s)):
    return False
  
  for i in range(n-1):
    if s[i][-1] != s[i+1][0]:
      return False
  
  return True

if __name__ == '__main__':
  if shiritori(s):
    print("Yes")
  else:
    print("No")

Verdicts: Runtime Error

Wrong Answer

Accepted