Buggy python submission (verdict: Runtime Error):
N = int(input())
words = [input() for i in range(N)]

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

print("Yes")


Fixed submission:
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")

Buggy python submission (verdict: Runtime Error):
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(1)

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

    

    


Fixed submission:
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")

Buggy python submission (verdict: Runtime Error):
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(1)

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


Fixed submission:
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")

Buggy python submission (verdict: Runtime Error):
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(1)

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


Fixed submission:
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")

Buggy python submission (verdict: Runtime Error):
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")

Fixed submission:
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")

Buggy python submission (verdict: Runtime Error):
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)
    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):
  if words[h] == words[h+1]:
    words[h] = True
    words[h+1] = True
  else:
    print("No")
    exit(1)
    
if all(l):
  print("Yes")
  
  


Fixed submission:
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")

Buggy python submission (verdict: Runtime Error):
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)
    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):
  print("Yes")
else:
  print("No")
  
  


Fixed submission:
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")

Buggy python submission (verdict: Runtime Error):
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)
    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):
  print("Yes")
else:
  print("No")
  
  


Fixed submission:
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")

Buggy python submission (verdict: Runtime Error):
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")
  
  

Fixed submission:
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")