Problem:


Score : 100 points

Problem Statement

You are given three strings A, B and C. Check whether they form a word chain.

More formally, determine whether both of the following are true:

The last character in A and the initial character in B are the same.

The last character in B and the initial character in C are the same.

If both are true, print YES. Otherwise, print NO.

Constraints

A, B and C are all composed of lowercase English letters (a - z).

1 ≤ |A|, |B|, |C| ≤ 10, where |A|, |B| and |C| are the lengths of A, B and C, respectively.

Input

Input is given from Standard Input in the following format:

A B C

Output

Print YES or NO.

Sample Input 1

rng gorilla apple

Sample Output 1

YES

They form a word chain.

Sample Input 2

yakiniku unagi sushi

Sample Output 2

NO

A and B form a word chain, but B and C do not.

Sample Input 3

a a a

Sample Output 3

YES

Sample Input 4

aaaaaaaaab aaaaaaaaaa aaaaaaaaab

Sample Output 4

NO



Sample input:
rng gorilla apple


Sample output:
YES

Submission status: Accepted

Solution code:
a,b,c=input().split()
a=list(a)
b=list(b)
c=list(c)
if a[len(a)-1]==b[0] and b[len(b)-1]==c[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
x, y, z = [i for i in input().split()]
if x[-1] != y[0]:
     print('NO')
elif y[-1] != z[0]:
    print('NO')
else: 
    print ('YES')

Submission status: Accepted

Solution code:
# A - Shiritori
a, b, c = input().split()
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Submission status: Accepted

Solution code:
a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
    ans = "YES"
else:
    ans = "NO"
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
A, B, C = input().split()
if(A[-1] == B[0] and B[-1] == C[0]):
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
A,B,C = map(str, input().split())
print('YNEOS'[not(A[-1]==B[0] and B[-1]==C[0])::2])

Submission status: Accepted

Solution code:
A,B,C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
  print('YES')
else:print('NO')

Submission status: Accepted

Solution code:
A,B,C = input().split()
if A[-1]== B[0] and B[-1]==C[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
A,B,C = (x for x in input().split())

list_A = list(A)
list_B = list(B)
list_C = list(C)

if list_A[len(list_A)-1] == list_B[0] and list_B[len(list_B)-1] == list_C[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
A,B,C=input().split()
f=A[-1]==B[0] and B[-1]==C[0]
print('YES' if f else 'NO')

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())
print('YES'if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Submission status: Accepted

Solution code:
a,b,c=input().split()
if a[-1]==b[0]:
    if b[-1]==c[0]:
        print('YES')
    else:
        print('NO')
else:
    print('NO')

Submission status: Accepted

Solution code:
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

a,b,c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C = map(str,input().split())
if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = list(input().split())
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Submission status: Accepted

Solution code:
a,b,c= map(str ,input().split())
if a[-1:]==b[0] and b[-1:]==c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = input().split()

if (a[-1] == b[0]) and (b[-1] == c[0]):
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c=map(str,input().split())
o=a[-1:];p=b[0];q=b[-1:];r=c[0]
if o == p and q == r:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
A,B,C = input().strip().split()
if A[-1]==B[0] and B[-1]==C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C = input().split()

A = A[len(A)-1:len(A)]
Bf = B
Bl = B
Bf = Bf[0:1]
Bl = Bl[len(B)-1:len(B)]
C = C[0:1]

if A == Bf:
    if Bl == C:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

Submission status: Accepted

Solution code:
x,y,z=input().split()
lx=len(x)
ly=len(y)
lz=len(z)
if x[lx-1]==y[0]:
    if y[ly-1]==z[0]:
        print("YES")
    else:
        print("NO")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c=(input().split())
alen=len(a)
blen=len(b)
clen=len(c)
if a[int(alen)-1]==b[0] and b[int(blen)-1]==c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A, B, C = input().split(" ")

if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
x = input().split()
a = x[0]
b = x[1]
c = x[2]

if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
s = input().split()
if s[0][-1] == s[1][0] and s[1][-1] == s[2][0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a = list(map(str,input().split()))
A = a[0]
B = a[1]
C = a[2]

if A[-1] == B[0] and B[-1] == C[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())

a_last = a[len(a) - 1]
b_last = b[len(b) - 1]

if a_last == b[0] and b_last == c[0] :
    print('YES')
else :
    print('NO')

Submission status: Accepted

Solution code:
a,b,c = map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c=input().split()
if(a[-1]==b[0] and b[-1]==c[0]):
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A = list(input().split())
print('YES' if A[0][-1]==A[1][0] and A[1][-1]==A[2][0] else 'NO')

Submission status: Accepted

Solution code:
a, b, c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    ans = "YES"
else:
    ans = "NO"

print(ans)

Submission status: Accepted

Solution code:
A, B, C = input().split()

if A[-1] == B[0] and B[-1] == C[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a,b,c=input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c = map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
A,B,C=map(str,input().split());print('YNEOS'[A[-1]!=B[0] or B[-1]!=C[0]::2])

Submission status: Accepted

Solution code:
A, B, C = tuple(input().split())
if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())

if a[-1] == b[0] and b[-1] == c[0]: print("YES")
else: print("NO")

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    a, b, c = list(map(str, str(input().rstrip('\n')).split()))
    print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
A,B,C=list(input().split())
A=list(A)
B=list(B)
C=list(C)
if A[-1]==B[0] and B[-1]==C[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c=map(str, input().split())
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c = map(str, input().split())
an = len(a)
bn = len(b)

if a[an-1] == b[0]:
  if b[bn-1] == c[0]:
    print('YES')
    exit()
print('NO')

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    a, b, c = input().split()
    print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a, b, c = input().split()
print('YES' if (a[-1] == b[0]) and (b[-1] == c[0]) else 'NO')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

A,B,C = input().split()
A=list(A)
B=list(B)
C=list(C)

if A[-1]==B[0] and B[-1]==C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C=input().split()

if A[-1]==B[0] and B[-1]==C[0]:
  print('YES')
  
else:
  print('NO')

Submission status: Accepted

Solution code:

A, B, C = input().split()

if A[-1] == B[0]:
    if B[-1] == C[0]:
        print('YES')
    else:
        print('NO')
else:
    print('NO')

Submission status: Accepted

Solution code:
a, b, c = input().split()
if a[-1] != b[0]:
  print("NO")
elif b[-1] != c[0]:
  print("NO")
else:
  print("YES")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

a,b,c = input().split()

lis_a = list(a)
lis_b = list(b)
lis_c = list(c)

isATrue = (lis_a[-1] == lis_b[0])
isBTrue = (lis_b[-1] == lis_c[0])

if isATrue and isBTrue:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A, B, C = input().split()
print("YES" if (A[-1] == B[0] and B[-1] == C[0]) else "NO")

Submission status: Accepted

Solution code:
a,b,c=map(str,input().split())

if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a, b, c = [s for s in input().split()]
if a[-1:] == b[0] and b[-1:] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
def do():
    a,b,c=STRM()
    if a[-1]==b[0] and b[-1]==c[0]:
        print('YES')
    else:
        print('NO')
if __name__ == '__main__':
    do()

Submission status: Accepted

Solution code:
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
   print('YES')
else:
   print('NO')

Submission status: Accepted

Solution code:
#coding:utf-8

a, b, c = map(str, input().split())

if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
l = input().split()
a = l[0][-1] == l[1][0]
b = l[1][-1] == l[2][0]
flag = a and b
if flag:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c=input().split()
print('YES' if a[-1]==b[0] and b[-1] == c[0] else 'NO')

Submission status: Accepted

Solution code:
a,b,c = map(str, input().split())
if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = input().rstrip().split()
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
ABC = list(map(list,input().split()))
for i in range(2):
    if ABC[i][-1] != ABC[i+1][0]:
        print("NO")
        break
    if i == 1:
        print("YES")

Submission status: Accepted

Solution code:
a, b, c = input().split()
if a[len(a) - 1] == b[0] and b[len(b) - 1] == c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
def main():
    a,b,c=input().split(' ')
    if a[-1] == b[0] and b[-1] == c[0]:
        print('yes'.upper())
    else:
        print('no'.upper())

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B,C = map(str, input().split())

if (A[-1]==B[0]) and (B[-1]==C[0]):
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
A, B, C= input().split()
print('YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO')

Submission status: Accepted

Solution code:
def resolve():
    a, b, c = input().split()
    print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    

s1,s2,s3=map(str,input().split())

if s1[-1]==s2[0] and s2[-1]==s3[0]:
	print("YES")
else:
	print("NO")

Submission status: Accepted

Solution code:
A,B,C = input().split()

if A[len(A)-1]==B[0] and B[len(B)-1]==C[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
s=list(input().split())
a=list(s[0])
b=list(s[1])
c=list(s[2])
if a[-1]==b[0] and b[-1]==c[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())
if a[-1]==b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a, b, c = list(input().split(' '))
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
A, B, C = list(input().split())

if ((A[-1] == B[0]) and (B[-1] == C[0])):
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C = input().split()
if A[-1]==B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c = input().split()
print("YES" if a[-1]==b[0] and b[-1] == c[0] else "NO")

Submission status: Accepted

Solution code:
a,b,c=input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Submission status: Accepted

Solution code:
A,B,C=input().split();print("YNEOS"[A[-1]!=B[0]or B[-1]!=C[0]::2])

Submission status: Accepted

Solution code:
A,B,C=input().split()

if A[-1]==B[0] and B[-1]==C[0]:
    print('YES')
else :
    print('NO')

Submission status: Accepted

Solution code:
#Aの最後の文字とBの最初の文字が同じ
#Bの最後の文字とCの最初の文字が同じ

a,b,c = map(str,input().split())

if (a[-1] == b[0]) and (b[-1] == c[0]):
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c = input().split()
print(["NO","YES"][a[-1]==b[0] and b[-1]==c[0]])

Submission status: Accepted

Solution code:
A, B, C = map(str, input().split())
print('YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    A, B, C = input().strip().split()

    if A[-1] == B[0] and B[-1] == C[0]:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a,b,c=input().split();print('YNEOS'[a[-1]!=b[0] or b[-1]!=c[0]::2])

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())

if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c=input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')

Submission status: Accepted

Solution code:
A,B,C = map(str, input().split())

if (A[-1] == B[0]) and (B[-1] == C[0]):
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
A,B,C = map(str,input().split())
print('YES') if A[len(A)-1] == B[0] and B[len(B)-1] == C[0] else print('NO')

Submission status: Accepted

Solution code:
strings = list(input().split())

flag = 'YES'
for i in range(2):
    if strings[i][-1] != strings[i+1][0]:
        flag = 'NO'
print(flag)

Submission status: Accepted

Solution code:
A,B,C = map(list, input().split())
print('YES' if A[len(A)-1]==B[0] and B[len(B)-1]==C[0] else 'NO')

Submission status: Accepted

Solution code:
a, b ,c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else :
  print("NO")

Submission status: Accepted

Solution code:

a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = input().split()
if all((a[-1] == b[0], b[-1] == c[0])):
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a,b,c = input().split()
print('YNEOS'[not(a[-1] == b[0] and b[-1]==c[0])::2])

Submission status: Accepted

Solution code:
s = input().split()
a, b, c = s[0], s[1], s[2]
if a[len(a) - 1] == b[0] and b[len(b) - 1] == c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Submission status: Accepted

Solution code:
a,b,c=input().split()

if a[-1:]==b[0] and b[-1:]==c[0]:
    print("YES")

else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
import sys
import copy
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

a, b, c = input().split()
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Submission status: Accepted

Solution code:
s = [i for i in input().split()]
print('YES' if s[0][-1]==s[1][0] and s[1][-1]==s[2][0] else 'NO')

Submission status: Accepted

Solution code:
a,b,c=input().split()
ans='NO'
if a[-1]==b[0]:
  if b[-1]==c[0]:
    ans='YES'
print(ans)

Submission status: Accepted

Solution code:
a,b,c = (str(i) for i in input().split())

A = list(a)
B = list(b)
C = list(c)

if A[-1] == B[0] and B[-1] == C[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
	print("YES")
else: print("NO")

Submission status: Accepted

Solution code:
A, B, C = input().split()
print("YES") if A[-1] == B[0] and B[-1] == C[0] else print("NO")

Submission status: Accepted

Solution code:
A,B,C = input().split()

if(A[-1]==B[0] and B[-1]== C[0]):
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c = input().split()

if a[-1:] == b[:1] and b[-1:] == c[:1]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
a,b,c=map(str,input().split())
if a[-1]!=b[0]:
    print('NO')
else:
    if b[-1]!=c[0]:
        print('NO')
    else:
        print('YES')

Submission status: Accepted

Solution code:
a,b,c = input().split()
if(a[-1] == b[0] and b[-1] == c[0]):
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
# ARC 060 A

def resolve():
    a, b, c = input().split()
    if a[-1] == b[0] and b[-1] == c[0]:
        print('YES')
    else:
        print('NO')

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
A = list(map(str,input().split()))
if A[0][(len(A[0]))-1] == A[1][0] and A[1][(len(A[1]))-1] == A[2][0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
A, B, C = input().split()

if A[-1]==B[0] and B[-1]==C[0]:print('YES')
else:print('NO')

Submission status: Accepted

Solution code:
A,B,C = map(str,input().split())
judge = True
if A[-1] != B[0]:
    judge = False
if B[-1] != C[0]:
    judge = False
if judge:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
if a[len(a)-1]==b[0] and b[len(b)-1]==c[0]: print('YES')
else: print('NO')

Submission status: Accepted

Solution code:
S = input().split()
if S[0][-1] == S[1][0] and S[1][-1] == S[2][0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
def main():
    A, B, C = input().split()
    if A[-1] == B[0] and B[-1] == C[0]:
        return "YES"
    return "NO"


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

Submission status: Accepted

Solution code:
a,b,c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
s = input().split()
print('YES' if all(s[i][-1] == s[i+1][0] for i in range(2)) else 'NO')

Submission status: Accepted

Solution code:
a, b, c = map(str, input().split())
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Submission status: Accepted

Solution code:
a,b,c=input().split();print("YNEOS"[a[-1]!=b[0] or b[-1]!=c[0]::2])

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
	print("YES")
else:
	print("NO")

Submission status: Accepted

Solution code:
a,b,c=input().split()

if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
A,B,C = input().strip().split(' ')
print('YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO')

Submission status: Accepted

Solution code:
a,b,c = input().split(' ')

if ( a[-1] == b[0] and b[-1] == c[0] ):
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a,b,c = [i for i in input().split()]

if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
words = list(input().split())


for i in range(len(words)-1):
	if words[i][-1] == words[i+1][0]:
		ans = 'YES'
	else:
		ans = 'NO'
		break
		
print(ans)

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())

if (a[len(a)-1] == b[0]) and (b[len(b)-1] == c[0]):
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
words = [s for s in input().split()]
if (words[0][-1]==words[1][0]) and (words[1][-1] == words[2][0]):
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a,b,c=map(str,input().split())

if a[-1]==b[0] and b[-1]==c[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
a, b, c = (i for i in input().split())
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Submission status: Accepted

Solution code:
a,b,c = input().split(" ")
if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
if a[-1] == b[0]:
  if b[-1] == c[0]:
    print('YES')
  else:
    print('NO')
else:
  print('NO')

Submission status: Accepted

Solution code:
a,b,c=input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else "NO")

Submission status: Accepted

Solution code:
A, B, C = input().split()
print("YES") if list(A)[-1] == list(B)[0] and list(B)[-1] == list(C)[0] else print("NO")

Submission status: Accepted

Solution code:
A, B, C = map(str, input().split())

if A[-1] == B[0] and B[-1] == C[0]:
  print ('YES')
else:
  print ('NO')

Submission status: Accepted

Solution code:
lines = input().split()
last_a = lines[0][len(lines[0])-1]
first_b = lines[1][0]
last_b = lines[1][len(lines[1])-1]
first_c = lines[2][0]

if last_a == first_b and last_b == first_c:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b, c = map(str, input().split())

if a[-1:] == b[0] and b[-1:] == c[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
A, B, C = input().split()
if A[-1]==B[0] and B[-1]==C[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
n = input().split()
print('YES' if n[0][-1] == n[1][0] and n[1][-1] == n[2][0] else 'NO')

Submission status: Accepted

Solution code:
A, B, C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
A, B, C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
A,B,C = input().split()
print('YES' if A[-1]==B[0] and B[-1]==C[0] else 'NO')

Submission status: Accepted

Solution code:
a, b, c = map(str,input().split())
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Submission status: Accepted

Solution code:
def test():
    a,b,c = input().split()
    print("YES" if a[len(a)-1] == b[0] and b[len(b)-1] == c[0] else "NO")


if __name__ == "__main__":
    test()

Submission status: Accepted

Solution code:
s1, s2, s3 = input().split()
if s1[-1] == s2[0] and s2[-1] == s3[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c = input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')

Submission status: Accepted

Solution code:
(a, b, c) = input().split()
print("YES" if a[-1] == b[0] and b[-1] == c[0] else "NO")

Submission status: Accepted

Solution code:
a,b,c=input().split();print('YES'if a[-1]==b[0] and b[-1]==c[0] else'NO')

Submission status: Accepted

Solution code:
a=list(input().split())
if a[0][-1] == a[1][0] and a[1][-1] == a[2][0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
word1,word2,word3 = map(str,input().split())
if word1[-1] == word2[0] and word2[-1] == word3[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
Tmp = []
Tmp = input().rstrip().split(' ')

S1 = Tmp[0]
S2 = Tmp[1]
S3 = Tmp[2]

if S1[-1]==S2[0] and S2[-1]==S3[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
a, b, c = map(str , input().split())

if a[-1] == b[0] and b[-1] == c[0] :
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
print("YES" if a[-1]==b[0] and b[-1]==c[0] else"NO")

Submission status: Accepted

Solution code:
A, B, C = map(str, input().split())
if A[-1] == B[0] and B[-1] == C[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
def main():
    s = input().split()
    
    s1=list(s[0])
    s2=list(s[1])
    s3=list(s[2])
    a=len(s1)
    b=len(s2)
    c=len(s3)
    if(s1[a-1]==s2[0] and s2[b-1]==s3[0]):
        print("YES")
    else:
        print("NO")
    
main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


def yes():
    print("YES")  # type: str


def no():
    print("NO")  # type: str


def solve(A: str, B: str, C: str):
    if A[-1] == B[0] and B[-1] == C[0]:
        yes()
    else:
        no()
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = next(tokens)  # type: str
    B = next(tokens)  # type: str
    C = next(tokens)  # type: str
    solve(A, B, C)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B,C = input().split()
print("YES" if A[len(A)-1]==B[0] and B[len(B)-1] == C[0] else "NO")

Submission status: Accepted

Solution code:
A,B,C = input().split()
print("YES" if A[-1]==B[0] and B[-1] == C[0] else "NO")

Submission status: Accepted

Solution code:
a,b,c=[s for s in input().split()]

if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
A, B, C = input().split()

print ("YES" if A[-1] == B[0] and B[-1] == C[0] else "NO")

Submission status: Accepted

Solution code:
a , b , c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A, B, C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
s = input().split()

a = s[0]
b = s[1]
c = s[2]
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = input().split(' ')
if a[-1] == b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a,b,c=input().split()

if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c=map(str,input().split())
print(("NO","YES")[a[-1]==b[0] and b[-1]==c[0]])

Submission status: Accepted

Solution code:
A,B,C=input().split()
if (A[-1]==B[0])and(B[-1]==C[0]):
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a, b, c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
#16:05
a,b,c = input().split()
x = int(a[-1]==b[0]) * int(b[-1]==c[0])
if x == 1:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:

a,b,c = input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")

Submission status: Accepted

Solution code:
a, b, c = input().split(' ')
print('YES' if a[-1] == b[0] and b[-1] == c[0] else 'NO')

Submission status: Accepted

Solution code:
s = list(map(str,input().split()))
print("YES" if s[0][-1] == s[1][0] and s[1][-1] == s[2][0] else "NO")

Submission status: Accepted

Solution code:
A, B, C = input().split()

if A[-1] == B[0] and B[-1] == C[0] :
    print('YES')
else :
    print('NO')

Submission status: Accepted

Solution code:
a,b,c=input().split();print('YNEOS'[a[-1]+c[0]!=b[0]+b[-1]::2])

Submission status: Accepted

Solution code:
a, b, c  = list(input().split())
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
#60

A, B, C = input().rstrip().split()

if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c=input().split()
print("YNEOS"[a[-1]!=b[0]or b[-1]!=c[0]::2])

Submission status: Accepted

Solution code:
A,B,C = input().split()

if A[-1] == B[0] and B[-1] == C[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

# input
A, B, C = map(str, input().split())

# solve & output
print('YES' if A[-1] == B[0] and B[-1] == C[0] else 'NO')

Submission status: Accepted

Solution code:
A,B,C = input().split()
 
if A[-1]==B[0] and B[-1]==C[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
s = list(input().split())
if s[0][-1] == s[1][0] and s[1][-1] == s[2][0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a,b,c = map(str,input().split())
if a[len(a)-1]==b[0]and b[len(b)-1]==c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C=[x for x in input().split()]
if A[-1]==B[0] and B[-1]==C[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
a,b,c = input().split()

if a[-1]==b[0] and b[-1] == c[0]:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
num = input().split()
print('YES') if num[0][-1]==num[1][0] and num[1][-1]==num[2][0] else print('NO')

Submission status: Accepted

Solution code:
a,b,c=map(str, input().split())
if a[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
s=input().split()
if s[0][-1]==s[1][0] and s[1][-1]==s[2][0]:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
x,y,z = input().split()
if x[-1] == y[0] and y[-1] == z[0]:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
a, b, c = input().split()
print("YES") if a[-1] == b[0] and b[-1] == c[0] else print("NO")

Submission status: Accepted

Solution code:
A,B,C = input().split()
if A[-1] == B[0] and B[-1] == C[0]:
    print('YES')

else:
    print('NO')

Submission status: Accepted

Solution code:
def main():
    A, B, C = input().split()
    print('YNEOS'[A[-1] != B[0] or B[-1] != C[0]::2])


main()